[gnome-boxes] Add NULL checks for InstallerMedia.os_media
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Add NULL checks for InstallerMedia.os_media
- Date: Mon, 2 Dec 2013 23:39:14 +0000 (UTC)
commit 4262510a5f624a6d9c492792bb7f07c762312e9d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Dec 2 23:37:49 2013 +0000
Add NULL checks for InstallerMedia.os_media
Check if InstallerMedia.os_media is non-null before using it, otherwise
we get a crash if its NULL.
src/installer-media.vala | 2 +-
src/vm-creator.vala | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 9bc42bc..af3b205 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -148,7 +148,7 @@ private class Boxes.InstallerMedia : GLib.Object {
protected void label_setup (string? label = null) {
if (label != null)
this.label = label;
- else if (os != null) {
+ else if (os != null && os_media != null) {
var variants = os_media.get_os_variants ();
if (variants.get_length () > 0)
// FIXME: Assuming first variant only from multivariant medias.
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 2005723..dbd5dbc 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -227,10 +227,12 @@ private class Boxes.VMCreator {
if (install_media.os != null) {
base_name = install_media.os.short_id;
- var variants = install_media.os_media.get_os_variants ();
- if (variants.get_length () > 0)
- // FIXME: Assuming first variant only from multivariant medias.
- base_name += "-" + variants.get_nth (0).id;
+ if (install_media.os_media != null) {
+ var variants = install_media.os_media.get_os_variants ();
+ if (variants.get_length () > 0)
+ // FIXME: Assuming first variant only from multivariant medias.
+ base_name += "-" + variants.get_nth (0).id;
+ }
} else
base_name = "boxes-unknown";
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]