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