From a46daccc110b6a43bf1dba928d7f1f1e72a14d81 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Thu, 20 Apr 2023 21:55:47 +0200 Subject: fix missing font crash and use color index as rgb if not found --- swt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'swt.c') diff --git a/swt.c b/swt.c index 446267a..b16447d 100644 --- a/swt.c +++ b/swt.c @@ -72,7 +72,7 @@ static int execshortcut(); static char *kmap(); static void buffer_release(void *data, struct wl_buffer *buffer); static void draw_frame(); -static uint32_t get_color(int i); +static uint32_t get_color(uint32_t i); static void draw_glyph(Glyph g, int x, int y); static void commit_surface(); static void surface_configure(void *data, struct xdg_surface *surface, uint32_t serial); @@ -216,10 +216,11 @@ paste() uint32_t -get_color(int i) +get_color(uint32_t i) { - if (!BETWEEN(i, 0, sizeof(colors) / sizeof(uint32_t))) - return colors[defaultbg]; + if (!BETWEEN(i, 0, sizeof(colors) / sizeof(uint32_t))) { + return i; + } return colors[i]; } -- cgit v1.2.3-70-g09d2