diff options
Diffstat (limited to 'lldb/source/Target/ThreadList.cpp')
-rw-r--r-- | lldb/source/Target/ThreadList.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp index 2b5a10d8c15..79df0f2184e 100644 --- a/lldb/source/Target/ThreadList.cpp +++ b/lldb/source/Target/ThreadList.cpp @@ -545,9 +545,13 @@ ThreadSP ThreadList::GetSelectedThread () { Mutex::Locker locker(m_threads_mutex); - if (m_selected_tid == LLDB_INVALID_THREAD_ID) - SetSelectedThreadByID(m_threads[0]->GetID()); - return FindThreadByID(m_selected_tid); + ThreadSP thread_sp = FindThreadByID(m_selected_tid); + if (!thread_sp.get()) + { + m_selected_tid = m_threads[0]->GetID(); + thread_sp = m_threads[0]; + } + return thread_sp; } bool |