diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-03-22 16:59:23 +0000 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2023-03-24 16:24:58 +0000 |
commit | 6ea328bc2d3700059d77b110c7825f995ef6c5b3 (patch) | |
tree | 424eb675393fa6612afd827bb109b9c2c77418a3 | |
parent | 41ffe9b42bad5085072c94c18fc9b6d17528a7ef (diff) |
fix crash seen when experimenting with tdf#129547
Change-Id: I0b26a7f683f91d3307856f86c5a437fde1155451
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149331
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 936f2e6924e405433770b98f32a615508fd0670d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149434
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit 252b27e3ce340526c6e5dc2e9bd38f1398e6f2f8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149514
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | framework/source/accelerators/acceleratorconfiguration.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 3507314a9a6e..ad08f375a177 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -64,7 +64,10 @@ namespace framework static OUString lcl_getKeyString(const css::awt::KeyEvent& aKeyEvent) { const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of an identifier... - OUStringBuffer sKeyBuffer((KeyMapping::get().mapCodeToIdentifier(aKeyEvent.KeyCode)).subView(nBeginIndex)); + OUString sKey(KeyMapping::get().mapCodeToIdentifier(aKeyEvent.KeyCode)); + if (sKey.getLength() < nBeginIndex) // dead key + return OUString(); + OUStringBuffer sKeyBuffer(sKey.subView(nBeginIndex)); if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT ) sKeyBuffer.append("_SHIFT"); |