[gnome-boxes/unattended-installer-warnings: 2/2] unattended-installer: Avoid accessing non-existant gvariant child




commit 80297db2f038afccdf936d84973347f233602805
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Apr 21 13:25:00 2021 +0200

    unattended-installer: Avoid accessing non-existant gvariant child
    
    It's an error when index_ is greater than the number of child items
    in the container.
    https://valadoc.org/glib-2.0/GLib.Variant.get_child_value.html

 src/unattended-installer.vala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 53114380..0973136e 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -670,7 +670,7 @@ private string get_preferred_keyboard (string lang) {
             var input_settings = new GLib.Settings ("org.gnome.desktop.input-sources");
             var sources = input_settings.get_value ("sources");
 
-            if (sources != null) {
+            if (sources != null && sources.n_children () >= 1) {
                 var sources_pair = sources.get_child_value (0);
                 if (sources_pair != null) {
                     var sources_pair_value = sources_pair.get_child_value (1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]