[libhandy] avatar: Check the icon is valid before using it
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] avatar: Check the icon is valid before using it
- Date: Tue, 21 Jul 2020 20:44:35 +0000 (UTC)
commit 36b8b469ed0d487390f6ea6f5c8eb705b51a57bd
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Jul 14 22:57:44 2020 +0200
avatar: Check the icon is valid before using it
This fixes a crash when the icon isn't found.
src/hdy-avatar.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/src/hdy-avatar.c b/src/hdy-avatar.c
index 76fb5ced..31ae8026 100644
--- a/src/hdy-avatar.c
+++ b/src/hdy-avatar.c
@@ -387,6 +387,12 @@ hdy_avatar_draw (GtkWidget *widget,
icon_name,
size / 2, scale,
GTK_ICON_LOOKUP_FORCE_SYMBOLIC);
+ if (icon == NULL) {
+ g_critical ("Failed to load icon `%s'", icon_name);
+
+ return FALSE;
+ }
+
gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
pixbuf = gtk_icon_info_load_symbolic (icon, &color, NULL, NULL, NULL, NULL, &error);
if (error != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]