summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Savochenko <[email protected]>2023-06-29 21:35:24 +0900
committerMichele Calgaro <[email protected]>2023-06-30 16:18:22 +0900
commit87b9269efb6aa965c1979972be7bdb045ef1ea58 (patch)
tree48585b8d103c9683fcdb3bf91da0e44ddd0df862
parent1206271a073538f11f1096165b454d77a0759650 (diff)
downloadtdebase-87b9269efb6aa965c1979972be7bdb045ef1ea58.tar.gz
tdebase-87b9269efb6aa965c1979972be7bdb045ef1ea58.zip
kxkb: prevent overflow in case of non-existing layout group
Signed-off-by: Roman Savochenko <[email protected]> Signed-off-by: Michele Calgaro <[email protected]> (cherry picked from commit d4d334c1af9256d6540b15e0188e9eb82b1fad55)
-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
+}