[Lldb-commits] [lldb] r260331 - Don't dereference the first element of an empty container.

Adrian McCarthy via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 9 16:06:51 PST 2016


Author: amccarth
Date: Tue Feb  9 18:06:50 2016
New Revision: 260331

URL: http://llvm.org/viewvc/llvm-project?rev=260331&view=rev
Log:
Don't dereference the first element of an empty container.

Modified:
    lldb/trunk/source/Symbol/Symtab.cpp

Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=260331&r1=260330&r2=260331&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Tue Feb  9 18:06:50 2016
@@ -56,7 +56,7 @@ Symtab::Resize(size_t count)
     // Clients should grab the mutex from this symbol table and lock it manually
     // when calling this function to avoid performance issues.
     m_symbols.resize (count);
-    return &m_symbols[0];
+    return m_symbols.empty() ? nullptr : &m_symbols[0];
 }
 
 uint32_t




More information about the lldb-commits mailing list