[hackers] [st][PATCH] Follow text color only if exists

From: Ivan Tham <pickfire_AT_riseup.net>
Date: Sun, 15 Jul 2018 00:01:49 +0800

Fix crash when text color is not set and is out of bound.
---
 x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x.c b/x.c
index b51821d..4b7ffe6 100644
--- a/x.c
+++ b/x.c
_AT_@ -1425,7 +1425,7 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
 
 		if (g.mode & ATTR_BOLD && BETWEEN(g.fg, 0, 7))
 			drawcol = dc.col[g.fg + 8];
-		else
+		else if (g.fg < LEN(dc.col))
 			drawcol = dc.col[g.fg];
 	}
 
-- 
2.18.0
Received on Sat Jul 14 2018 - 18:01:49 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 14 2018 - 18:12:22 CEST