[gnome-boxes/check-for-oses-without-medias-3-30] wizard-downloads: Check for OSes without medias
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/check-for-oses-without-medias-3-30] wizard-downloads: Check for OSes without medias
- Date: Mon, 26 Nov 2018 12:41:19 +0000 (UTC)
commit 42e4d0778489bc2a55192cfa3c0f22763f7b0e42
Author: Felipe Borges <felipeborges gnome org>
Date: Mon Nov 26 13:34:35 2018 +0100
wizard-downloads: Check for OSes without medias
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/wizard-downloads-page.vala | 4 ++--
src/wizard-source.vala | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/wizard-downloads-page.vala b/src/wizard-downloads-page.vala
index caca4e65..97e8da02 100644
--- a/src/wizard-downloads-page.vala
+++ b/src/wizard-downloads-page.vala
@@ -91,8 +91,8 @@ private async void populate_recommended_list () {
try {
var os = yield os_db.get_os_by_id (os_id);
var media = os.get_media_list ().get_nth (0) as Osinfo.Media;
-
- recommended_model.append (media);
+ if (media != null)
+ recommended_model.append (media);
} catch (OSDatabaseError error) {
warning ("Failed to find OS with id: '%s': %s", os_id, error.message);
}
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index b153b355..7eef978b 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -444,8 +444,8 @@ private void populate_recommended_downloads () {
// TODO: Select the desktop/workstation variant.
var media = os.get_media_list ().get_nth (0) as Osinfo.Media;
-
- downloads_model.append (media);
+ if (media != null)
+ downloads_model.append (media);
} catch (OSDatabaseError error) {
warning ("Failed to find OS with ID '%s': %s", os_id, error.message);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]