aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/main.vala5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/main.vala b/lib/main.vala
index 53878989..e9eb27b6 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -580,7 +580,10 @@ public class Indicator.Keyboard.Service : Object {
var current = source_settings.get_uint ("current");
var length = (int) sources.n_children ();
- source_settings.set_uint ("current", (current + (length - parameter.get_int32 ())) % length);
+ if (length > 0) {
+ var offset = parameter.get_int32 () % length;
+ source_settings.set_uint ("current", (current + (length - offset)) % length);
+ }
}
}