diff options
Diffstat (limited to 'src/gui/gui-color.c')
-rw-r--r-- | src/gui/gui-color.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c index 6b5db98f2..dc77acaa9 100644 --- a/src/gui/gui-color.c +++ b/src/gui/gui-color.c @@ -235,6 +235,9 @@ gui_color_decode (const unsigned char *string) unsigned char *out; int out_length, out_pos, length; + if (!string) + return NULL; + out_length = (strlen ((char *)string) * 2) + 1; out = malloc (out_length); if (!out) @@ -294,8 +297,11 @@ gui_color_decode (const unsigned char *string) void gui_color_free (struct t_gui_color *color) { - if (color->string) - free (color->string); - - free (color); + if (color) + { + if (color->string) + free (color->string); + + free (color); + } } |