[gnome-boxes] util-app: Make recommended-downloads parsing handle empty media lists



commit 333dfad568ba77456ff3b00e6c2750d6a2cf0d73
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Aug 10 09:54:41 2022 +0200

    util-app: Make recommended-downloads parsing handle empty media lists

 src/util-app.vala | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/util-app.vala b/src/util-app.vala
index c0a42a94..c5f47ae2 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -250,7 +250,11 @@ private async GLib.List<Osinfo.Media>? parse_recommended_downloads_file (string
                 continue;
             }
 
-            var media = os.get_media_list ().get_nth (0) as Osinfo.Media;
+            var media_list = os.get_media_list ();
+            if (media_list == null || media_list.get_length () == 0)
+                continue;
+
+            var media = media_list.get_nth (0) as Osinfo.Media;
             if (media.url != null || os_id.has_prefix ("http://redhat.com";))
                 list.append (media);
 


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