diff options
author | William Hua <william.hua@canonical.com> | 2013-08-22 18:36:10 +0800 |
---|---|---|
committer | William Hua <william.hua@canonical.com> | 2013-08-22 18:36:10 +0800 |
commit | 3d0529fab0030e47859dc9e939465f4802399fbe (patch) | |
tree | 562c7851985a33d6769235021695e2ba284dec3d /lib/main.vala | |
parent | 4451d840969698c2d2106c013a95a3c6eb4baf70 (diff) | |
parent | 39fd9bd8383df1361c4141e4d0ad52a83a53a437 (diff) | |
download | ayatana-indicator-keyboard-3d0529fab0030e47859dc9e939465f4802399fbe.tar.gz ayatana-indicator-keyboard-3d0529fab0030e47859dc9e939465f4802399fbe.tar.bz2 ayatana-indicator-keyboard-3d0529fab0030e47859dc9e939465f4802399fbe.zip |
Merge trunk.
Diffstat (limited to 'lib/main.vala')
-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 ef94b2f2..601a599e 100644 --- a/lib/main.vala +++ b/lib/main.vala @@ -339,8 +339,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 ()); |