[Lldb-commits] [lldb] r283479 - StringRef::front asserts on empty strings, causing "break modify -c ''" to assert.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 6 11:57:30 PDT 2016


Author: jingham
Date: Thu Oct  6 13:57:30 2016
New Revision: 283479

URL: http://llvm.org/viewvc/llvm-project?rev=283479&view=rev
Log:
StringRef::front asserts on empty strings, causing "break modify -c ''" to assert.

Added a check for empty at the point where we were going to crash.

<rdar://problem/28654032>

Modified:
    lldb/trunk/source/Interpreter/CommandObject.cpp

Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=283479&r1=283478&r2=283479&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Thu Oct  6 13:57:30 2016
@@ -994,7 +994,7 @@ bool CommandObjectParsed::Execute(const
   }
   if (!handled) {
     for (auto entry : llvm::enumerate(cmd_args.entries())) {
-      if (entry.Value.ref.front() == '`') {
+      if (!entry.Value.ref.empty() && entry.Value.ref.front() == '`') {
         cmd_args.ReplaceArgumentAtIndex(
             entry.Index,
             m_interpreter.ProcessEmbeddedScriptCommands(entry.Value.c_str()));




More information about the lldb-commits mailing list