From bcb6069fe36b5fbe9e05f5c0d2820ac7b2adfe2e Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 28 Dec 2022 09:24:54 +0800 Subject: [PATCH] - fix: Crash while input using input method in makefile --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index c1879228..1e8ce5f9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ Red Panda C++ Version 2.8 - fix: Crash when editing makefile - enhancement: Add "Resources" in project option's dialog's custom compiler parameter page + - fix: Crash while input using input method in makefile Red Panda C++ Version 2.7 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index a3f76ca8..73c2a453 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1319,7 +1319,7 @@ void Editor::inputMethodEvent(QInputMethodEvent *event) && pSettings->codeCompletion().showCompletionWhileInput() ) { if (mLastIdCharPressed>=pSettings->codeCompletion().minCharRequired()) { QString lastWord = getPreviousWordAtPositionForSuggestion(caretXY()); - if (!lastWord.isEmpty()) { + if (mParser && !lastWord.isEmpty()) { if (CppTypeKeywords.contains(lastWord)) { return; } @@ -3515,7 +3515,7 @@ bool Editor::onCompletionInputMethod(QInputMethodEvent *event) if (!mCompletionPopup->isVisible()) return processed; QString s=event->commitString(); - if (!s.isEmpty()) { + if (mParser && !s.isEmpty()) { QString phrase = getWordForCompletionSearch(caretXY(),mCompletionPopup->memberOperator()=="::"); mLastIdCharPressed = phrase.length(); mCompletionPopup->search(phrase, false);