forked from OSchip/llvm-project
[EditLine] Check string pointers before dereferencing them.
Get*AtIndex() can return nullptr. This only happens in the swift REPL support, so it's hard to test upstream. <rdar://problem/50875178> llvm-svn: 361078
This commit is contained in:
parent
a9c7b2583f
commit
53f68c5764
|
@ -870,10 +870,11 @@ static void PrintCompletion(FILE *output_file, size_t start, size_t end,
|
|||
const char *completion_str = completions.GetStringAtIndex(i);
|
||||
const char *description_str = descriptions.GetStringAtIndex(i);
|
||||
|
||||
fprintf(output_file, "\n\t%-*s", max_len, completion_str);
|
||||
if (completion_str)
|
||||
fprintf(output_file, "\n\t%-*s", max_len, completion_str);
|
||||
|
||||
// Print the description if we got one.
|
||||
if (strlen(description_str))
|
||||
if (description_str && strlen(description_str))
|
||||
fprintf(output_file, " -- %s", description_str);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue