From 5c12e10be77351e88b6c550894e4ca34c99aacf8 Mon Sep 17 00:00:00 2001 From: William Hua Date: Mon, 12 Aug 2013 09:33:27 +0800 Subject: Fix out-of-bounds error. --- lib/main.vala | 8 +++++++- po/indicator-keyboard.pot | 8 ++++---- 2 files changed, 11 insertions(+), 5 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 ()); diff --git a/po/indicator-keyboard.pot b/po/indicator-keyboard.pot index db38e8ef..b5d5cfca 100644 --- a/po/indicator-keyboard.pot +++ b/po/indicator-keyboard.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-08-08 14:52-0400\n" +"POT-Creation-Date: 2013-08-12 09:33+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,14 +17,14 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../lib/main.c:1405 ../lib/main.vala:322 +#: ../lib/main.c:1419 ../lib/main.vala:328 msgid "Character Map" msgstr "" -#: ../lib/main.c:1407 ../lib/main.vala:323 +#: ../lib/main.c:1421 ../lib/main.vala:329 msgid "Keyboard Layout Chart" msgstr "" -#: ../lib/main.c:1409 ../lib/main.vala:324 +#: ../lib/main.c:1423 ../lib/main.vala:330 msgid "Text Entry Settings..." msgstr "" -- cgit v1.2.3