diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2021-08-05 12:52:15 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-05 14:25:23 +0000 |
commit | ea4860bcc85ab31647d8605cbdd8ba22e46bc063 (patch) | |
tree | ffe950cbcb1c5340f2f60111c23a409bcfd1bc04 | |
parent | a704c8a341416ea8e249eb9992777eff55148b00 (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
Change-Id: I04a13ff3abe4aef4a6edd2986aa943fc6d3d995d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 79e14f6c694c8c36dfea84c3962c3f0d476c8d8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/plugins/pinyin/plugin/pinyininputmethod.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/pinyin/plugin/pinyininputmethod.cpp b/src/plugins/pinyin/plugin/pinyininputmethod.cpp index 8c379770..7ae235bc 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); |