[gnome-boxes] Deal with Osinfo media == null



commit 5d1f9f56f4bcf0a9ceaa2e98f54e223c7e503cd8
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Tue May 22 18:19:13 2012 +0200

    Deal with Osinfo media == null
    
    According to my critical logs, "media" can be null.
    
    log_level=G_LOG_LEVEL_CRITICAL, format=
        0x380b2b563a "%s: assertion `%s' failed",
    args1=args1 entry=0x7fffffffd2d8) at gmessages.h:101
    (log_domain=log_domain entry=0x380c637e44 "GLib-GObject",
    log_level=log_level entry=
        G_LOG_LEVEL_CRITICAL, format=format entry=0x380b2b563a "%s:
    assertion `%s' failed") at gmessages.c:792
    (log_domain=log_domain entry=0x380c637e44 "GLib-GObject",
        pretty_function=pretty_function entry=0x380c63b111 "g_object_get",
    expression=expression entry=
        0x380c639f17 "G_IS_OBJECT (object)") at gmessages.c:801
    first_property_name=first_property_name entry=0x45d133 "live")
        at gobject.c:2101
    (_data_=0x1b28000) at installer-media.c:563
    (simple=0x18d0580 [GSimpleAsyncResult]) at gsimpleasyncresult.c:767
    boxes_os_database_guess_os_from_install_media_co (_data_=0x1617360) at
    os-database.c:281
    at os-database.c:238
    (simple=0x198d020 [GSimpleAsyncResult]) at gsimpleasyncresult.c:767
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676589

 src/installer-media.vala |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 39689fb..c912f9c 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -6,7 +6,7 @@ using GUdev;
 private class Boxes.InstallerMedia : Object {
     public Os? os;
     public Osinfo.Resources? resources;
-    public Media os_media;
+    public Media? os_media;
     public string label;
     public string device_file;
     public string mount_point;
@@ -17,7 +17,7 @@ private class Boxes.InstallerMedia : Object {
     public InstallerMedia.from_iso_info (string            path,
                                          string            label,
                                          Os                os,
-                                         Media             media,
+                                         Media?            media,
                                          Osinfo.Resources? resources) {
         this.device_file = path;
         this.label = label;
@@ -26,7 +26,7 @@ private class Boxes.InstallerMedia : Object {
         this.resources = resources;
         from_image = true;
 
-        if (media.live)
+        if (media != null && media.live)
             this.label = _("%s (Live)").printf (label);
     }
 
@@ -54,7 +54,7 @@ private class Boxes.InstallerMedia : Object {
 
         if (os != null)
             label = os.get_name ();
-            if (os_media.live)
+            if (os_media != null && os_media.live)
                 // Translators: We are appending " (Live)" suffix to name of OS media to indication that it's live.
                 //              http://en.wikipedia.org/wiki/Live_CD
                 label = _("%s (Live)").printf (label);



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