summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Savochenko <roman@oscada.org>2023-06-29 21:35:24 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-06-29 21:35:24 +0900
commitd4d334c1af9256d6540b15e0188e9eb82b1fad55 (patch)
treebaf7fb9c11cd0a0a9574d6310d4ad917fe61b09c
parentd17e353a028f5cbfc2afc03d7190adb1aea457aa (diff)
downloadtdebase-d4d334c1af9256d6540b15e0188e9eb82b1fad55.tar.gz
tdebase-d4d334c1af9256d6540b15e0188e9eb82b1fad55.zip
kxkb: prevent overflow in case of non-existing layout group
Signed-off-by: Roman Savochenko <roman@oscada.org> Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r--kxkb/kxkb.cpp9
1 files changed, 7 insertions, 2 deletions
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
+}