[gnome-boxes/check-for-oses-without-medias] util-app: Check for OSes without media



commit c3369630da2325a0884ca9a4365826e6faf6db00
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Nov 26 13:37:02 2018 +0100

    util-app: Check for OSes without media
    
    This is a very corner case, but it might happen that the user
    does not have data in the osinfo-db at all, causing us to
    populate the recommended list model with a null pointer.
    
    Fixes #283

 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 253d1b74..7e34209b 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -173,7 +173,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 != null)
+                    list.append (media);
             } catch (OSDatabaseError error) {
                 warning ("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]