fix: string index not checked

This commit is contained in:
Roy Qu 2022-11-16 11:51:50 +08:00
parent a9c266c39a
commit 19785f9c14
1 changed files with 1 additions and 2 deletions

View File

@ -3487,7 +3487,6 @@ bool Editor::onHeaderCompletionKeyPressed(QKeyEvent *event)
if (isIdentChar(ch) || ch == '.'
|| ch =='_' || ch=='+') {
commandProcessor(QSynedit::EditCommand::ecChar, ch);
phrase = getWordAtPosition(this,caretXY(),
pBeginPos,pEndPos,
WordPurpose::wpHeaderCompletion);
@ -4483,7 +4482,7 @@ QString Editor::getPreviousWordAtPositionForCompleteFunctionDefinition(const QSy
}
wordBegin++;
if (s[wordBegin]>='0' && s[wordBegin]<='9') // not valid word
if (wordBegin<s.length() && s[wordBegin]>='0' && s[wordBegin]<='9') // not valid word
return "";
result = s.mid(wordBegin, wordEnd - wordBegin+1);