[gnome-boxes/dont-add-recommended-downloads-entries-without-url: 10/10] util-app: Don't add OS to download list if URL is null




commit e528608256c31f53bd72e52c350b645a0dd5aeb1
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Oct 4 11:54:49 2021 +0200

    util-app: Don't add OS to download list if URL is null
    
    In issue #726 we see a case for when an OSes added to our
    recommended-downloads.xml list doesn't have an URL, causing an error.
    
    Since we encourage downstreams to tweak this list, we should prevent
    such synchronization (osinfo-db and Boxes) issues from happening.
    
    Let's check for media.url before adding the OSes.

 src/util-app.vala | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/util-app.vala b/src/util-app.vala
index b3ec5376..c59c382a 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -209,7 +209,8 @@ else if (media_url.contains ("dvd"))
                 var os = yield os_db.get_os_by_id (os_id);
                 var media = os.get_media_list ().get_nth (0) as Osinfo.Media;
 
-                list.append (media);
+                if (media.url != null)
+                    list.append (media);
             } catch (OSDatabaseError error) {
                 debug ("Failed to find OS with id: '%s': %s", os_id, error.message);
             }


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