aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2013-11-04 12:05:42 -0500
committerWilliam Hua <william.hua@canonical.com>2013-11-04 12:05:42 -0500
commitc01d6f3fa3e8663da142f23b9e36dcf57622c57d (patch)
tree78a83ed613042c18ea9471817472a79683c378b0
parent84fafd7a077a2383435c6668ce15559907df868f (diff)
downloadayatana-indicator-keyboard-c01d6f3fa3e8663da142f23b9e36dcf57622c57d.tar.gz
ayatana-indicator-keyboard-c01d6f3fa3e8663da142f23b9e36dcf57622c57d.tar.bz2
ayatana-indicator-keyboard-c01d6f3fa3e8663da142f23b9e36dcf57622c57d.zip
Be careful around large scrolling offsets.
-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);
+ }
}
}