From 81ba4e3a3e2ed00e6069364dcf5b421b05f2aa43 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 4 Aug 2015 16:43:26 +0800 Subject: [PATCH] Guard against empty image --- .../browser/linux/notification_presenter_linux.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/brightray/browser/linux/notification_presenter_linux.cc b/brightray/browser/linux/notification_presenter_linux.cc index 0c688906a7b6..db9c67d3c892 100644 --- a/brightray/browser/linux/notification_presenter_linux.cc +++ b/brightray/browser/linux/notification_presenter_linux.cc @@ -13,6 +13,7 @@ #include "content/public/common/platform_notification_data.h" #include "common/application_info.h" #include "dbus/dbus.h" +#include "third_party/skia/include/core/SkBitmap.h" namespace brightray { @@ -111,11 +112,12 @@ void NotificationPresenterLinux::ShowNotification( notification, "default", "View", OnNotificationViewThunk, this, nullptr); } - GdkPixbuf* pixbuf = libgtk2ui::GdkPixbufFromSkBitmap(icon); - - notify_notification_set_image_from_pixbuf(notification, pixbuf); - notify_notification_set_timeout(notification, NOTIFY_EXPIRES_DEFAULT); - g_object_unref(pixbuf); + if (!icon.drawsNothing()) { + GdkPixbuf* pixbuf = libgtk2ui::GdkPixbufFromSkBitmap(icon); + notify_notification_set_image_from_pixbuf(notification, pixbuf); + notify_notification_set_timeout(notification, NOTIFY_EXPIRES_DEFAULT); + g_object_unref(pixbuf); + } GError* error = nullptr; notify_notification_show(notification, &error);