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




commit 3a749a671be8e3aef2fe2c4284af7d810c4d7ee0
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]