33f0fbf
From 53a327d53cfc0da5861d65b9bd18cab591689170 Mon Sep 17 00:00:00 2001
33f0fbf
From: Michael Catanzaro <mcatanzaro@igalia.com>
33f0fbf
Date: Wed, 3 Jul 2019 18:50:49 -0500
33f0fbf
Subject: [PATCH] Avoid crashing when year view's weather icon is NULL
33f0fbf
33f0fbf
This is not a proper solution, because I don't see how it could possibly
33f0fbf
ever be NULL here. But a huge number of users are reporting this crash,
33f0fbf
so we have to try something.
33f0fbf
33f0fbf
This fixes #299, but I'm not happy with it.
33f0fbf
---
33f0fbf
 src/views/gcal-year-view.c | 6 +++++-
33f0fbf
 1 file changed, 5 insertions(+), 1 deletion(-)
33f0fbf
33f0fbf
diff --git a/src/views/gcal-year-view.c b/src/views/gcal-year-view.c
33f0fbf
index 25c432b8..bb4db5f1 100644
33f0fbf
--- a/src/views/gcal-year-view.c
33f0fbf
+++ b/src/views/gcal-year-view.c
33f0fbf
@@ -2154,7 +2154,11 @@ update_weather (GcalYearView *self)
33f0fbf
   if (!updated)
33f0fbf
     {
33f0fbf
       gtk_label_set_text (self->temp_label, "");
33f0fbf
-      gtk_image_clear (self->weather_icon);
33f0fbf
+      /* FIXME: This should never be NULL, but it somehow is.
33f0fbf
+       * https://gitlab.gnome.org/GNOME/gnome-calendar/issues/299
33f0fbf
+       */
33f0fbf
+      if (self->weather_icon != NULL)
33f0fbf
+        gtk_image_clear (self->weather_icon);
33f0fbf
     }
33f0fbf
 }
33f0fbf
 
33f0fbf
-- 
33f0fbf
2.21.0
33f0fbf