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 | |
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.
-rw-r--r-- | lib/main.vala | 8 | ||||
-rw-r--r-- | 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 <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\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 "" |