aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2021-08-05 12:52:15 +0300
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2021-08-05 13:51:25 +0300
commit79e14f6c694c8c36dfea84c3962c3f0d476c8d8e (patch)
treebaceef594f8a627ed3b9fad3c3e9dab13e693e8c /src
parent867cda67e3c8467c66954521eb96622fe37ba055 (diff)
pinyin: Prevent crash when pinyin dictionary cannot be loaded
In case the pinyin (system) dictionary cannot be found, the pinyin engine is nullptr. This can lead to a crash when update() is called. Prevent the crash by adding a nullptr check. Fixes: QTBUG-68412 Pick-to: 5.15 6.1 6.2 Change-Id: I04a13ff3abe4aef4a6edd2986aa943fc6d3d995d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/pinyin/plugin/pinyininputmethod.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/pinyin/plugin/pinyininputmethod.cpp b/src/plugins/pinyin/plugin/pinyininputmethod.cpp
index 4215ab51..975ce9cf 100644
--- a/src/plugins/pinyin/plugin/pinyininputmethod.cpp
+++ b/src/plugins/pinyin/plugin/pinyininputmethod.cpp
@@ -73,7 +73,7 @@ public:
QVirtualKeyboardInputContext *inputContext = q->inputContext();
// Disable the user dictionary when entering sensitive data
- if (inputContext) {
+ if (inputContext && pinyinDecoderService) {
bool userDictionaryEnabled = !inputContext->inputMethodHints().testFlag(Qt::ImhSensitiveData);
if (userDictionaryEnabled != pinyinDecoderService->isUserDictionaryEnabled())
pinyinDecoderService->setUserDictionary(userDictionaryEnabled);