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.
This commit is contained in:
Nikos Tsipinakis 2018-05-13 14:06:13 +03:00
parent 119340c07d
commit 54face5956

View File

@ -476,8 +476,10 @@ static void render_content(cairo_t *c, colored_layout *cl, int width)
if (settings.icon_position == icons_left) { if (settings.icon_position == icons_left) {
image_x = settings.h_padding; image_x = settings.h_padding;
} else { } else if (settings.icon_position == icons_right){
image_x = width - settings.h_padding - image_width; 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); cairo_set_source_surface(c, cl->icon, image_x, image_y);