[lldb] Fix a crash when tab-completion an empty line in a function with only one local variable
When LLDB sees only one possible completion for an input, it will add a trailing space to the completion to signal that to the user. If the current argument is quoted, that also means LLDB needs to add the trailing quote to finish the current argument first. In case the user is in a function with only one local variable and is currently editing an empty line in the multiline expression editor, then we are in the unique situation where we can have a unique completion for an empty input line. (In a normal LLDB session this would never occur as empty input would just list all the possible commands). In this special situation our check if the current argument needs to receive a trailing quote will crash LLDB as there is no current argument and the completion code just unconditionally tries to access the current argument. This just adds the missing check if we even have a current argument before we check if we need to add a terminating quote character. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D85903
Loading
Please sign in to comment