diff options
| -rw-r--r-- | lldb/source/API/SBValue.cpp | 7 | ||||
| -rw-r--r-- | lldb/test/python_api/value/change_values/TestChangeValueAPI.py | 4 | 
2 files changed, 9 insertions, 2 deletions
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index 876670a510c..654336db8c5 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -392,8 +392,11 @@ SBValue::CreateValueFromExpression (const char *name, const char* expression)                                                                           true, // keep in memory                                                                           eNoDynamicValues,                                                                           result_valobj_sp); -        result_valobj_sp->SetName(ConstString(name)); -        result = SBValue(result_valobj_sp); +        if (result_valobj_sp) +        { +            result_valobj_sp->SetName(ConstString(name)); +            result = SBValue(result_valobj_sp); +        }      }      LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));      if (log) diff --git a/lldb/test/python_api/value/change_values/TestChangeValueAPI.py b/lldb/test/python_api/value/change_values/TestChangeValueAPI.py index d2d9b1406b4..d5ecb1600a3 100644 --- a/lldb/test/python_api/value/change_values/TestChangeValueAPI.py +++ b/lldb/test/python_api/value/change_values/TestChangeValueAPI.py @@ -130,6 +130,10 @@ class ChangeValueAPITestCase(TestBase):          self.assertTrue (error.Success(), "Got a changed value for sp")          self.assertTrue (actual_value == 1, "Got the right changed value for sp.") +        # Boundary condition test the SBValue.CreateValueFromExpression() API. +        # LLDB should not crash! +        nosuchval = mine_value.CreateValueFromExpression(None, None) +          process.Continue()          self.assertTrue(process.GetState() == lldb.eStateStopped)  | 

