diff options
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 ()); |