From d4d334c1af9256d6540b15e0188e9eb82b1fad55 Mon Sep 17 00:00:00 2001 From: Roman Savochenko Date: Thu, 29 Jun 2023 21:35:24 +0900 Subject: kxkb: prevent overflow in case of non-existing layout group Signed-off-by: Roman Savochenko Signed-off-by: Michele Calgaro --- kxkb/kxkb.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'kxkb') diff --git a/kxkb/kxkb.cpp b/kxkb/kxkb.cpp index 4bc5bdbd7..8d725e3e5 100644 --- a/kxkb/kxkb.cpp +++ b/kxkb/kxkb.cpp @@ -274,7 +274,12 @@ void KXKBApp::menuActivated(int id) // } } -void KXKBApp::slotGroupChanged(uint group) { +void KXKBApp::slotGroupChanged(uint group) +{ + if (group >= kxkbConfig.m_layouts.count()) + { + group = 0; + } m_currentLayout = kxkbConfig.m_layouts[group]; m_tray->setCurrentLayout(m_currentLayout); } @@ -341,4 +346,4 @@ extern "C" KDE_EXPORT int kdemain(int argc, char *argv[]) app.disableSessionManagement(); app.exec(); return 0; -} \ No newline at end of file +} -- cgit v1.2.1