From 19785f9c148c76fcc87b7289c1df84d404ed2b18 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 16 Nov 2022 11:51:50 +0800 Subject: [PATCH] fix: string index not checked --- RedPandaIDE/editor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index c0efd09d..1a31fd32 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -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='0' && s[wordBegin]<='9') // not valid word return ""; result = s.mid(wordBegin, wordEnd - wordBegin+1);