From 54face5956ceea2649cbfe87598581efb77e7c8d Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Sun, 13 May 2018 14:06:13 +0300 Subject: [PATCH] Fix unchecked corner case in icon_position check In the case that cl->icon is not NULL we assume that icon_position is either left or right but this might not always be the case in the future. --- src/draw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/draw.c b/src/draw.c index cdf4f94..a670fe2 100644 --- a/src/draw.c +++ b/src/draw.c @@ -476,8 +476,10 @@ static void render_content(cairo_t *c, colored_layout *cl, int width) if (settings.icon_position == icons_left) { image_x = settings.h_padding; - } else { + } else if (settings.icon_position == icons_right){ image_x = width - settings.h_padding - image_width; + } else { + LOG_E("Tried to draw icon but icon position is not valid. %s:%d", __FILE__, __LINE__); } cairo_set_source_surface(c, cl->icon, image_x, image_y);