diff options
author | William Hua <william.hua@canonical.com> | 2013-08-12 09:33:27 +0800 |
---|---|---|
committer | William Hua <william.hua@canonical.com> | 2013-08-12 09:33:27 +0800 |
commit | 5c12e10be77351e88b6c550894e4ca34c99aacf8 (patch) | |
tree | ec407054fa0ec3ff4661055184a15a30b618fc60 /lib | |
parent | 61af9c29ee77c21923f65d06c1e3f17bafa90b97 (diff) | |
download | ayatana-indicator-keyboard-5c12e10be77351e88b6c550894e4ca34c99aacf8.tar.gz ayatana-indicator-keyboard-5c12e10be77351e88b6c550894e4ca34c99aacf8.tar.bz2 ayatana-indicator-keyboard-5c12e10be77351e88b6c550894e4ca34c99aacf8.zip |
Fix out-of-bounds error.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/main.vala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/main.vala b/lib/main.vala index 91466f8c..d601f6f9 100644 --- a/lib/main.vala +++ b/lib/main.vala @@ -220,8 +220,14 @@ public class Indicator.Keyboard.Service : Object { private void update_indicator_action () { var visible = indicator_settings.get_boolean ("visible"); var current = source_settings.get_uint ("current"); - var icon = get_sources ()[current].icon; + var sources = get_sources (); + Variant state; + Icon? icon = null; + + if (current < sources.length) { + icon = sources[current].icon; + } if (icon != null) { state = new Variant.parsed ("{ 'visible' : <%b>, 'icon' : %v }", visible, ((!) icon).serialize ()); |