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>

llvm-svn: 283479
This commit is contained in:
Jim Ingham 2016-10-06 18:57:30 +00:00
parent 6d6b4d87a3
commit d35ff4cb0d
1 changed files with 1 additions and 1 deletions

View File

@ -994,7 +994,7 @@ bool CommandObjectParsed::Execute(const char *args_string,
} }
if (!handled) { if (!handled) {
for (auto entry : llvm::enumerate(cmd_args.entries())) { 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( cmd_args.ReplaceArgumentAtIndex(
entry.Index, entry.Index,
m_interpreter.ProcessEmbeddedScriptCommands(entry.Value.c_str())); m_interpreter.ProcessEmbeddedScriptCommands(entry.Value.c_str()));