[lldb] Fix a crasher when using the public API. (#80508)
A user found a crash when they would do code like: ``` (lldb) script >>> target = lldb.SBTarget() >>> lldb.debugger.SetSelectedTarget(target) ``` We were not checking if the target was valid in and it caused a crash..
This commit is contained in:
@@ -526,3 +526,9 @@ class TargetAPITestCase(TestBase):
|
||||
target.IsLoaded(module),
|
||||
"Running the target should " "have loaded its modules.",
|
||||
)
|
||||
|
||||
@no_debug_info_test
|
||||
def test_setting_selected_target_with_invalid_target(self):
|
||||
"""Make sure we don't crash when trying to select invalid target."""
|
||||
target = lldb.SBTarget()
|
||||
self.dbg.SetSelectedTarget(target)
|
||||
|
||||
Reference in New Issue
Block a user