mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
drw_text: don't segfault when called with 0 width
this patch just rejects *any* 0 width draws, which is surely an error by the caller. this also guards against cases where the width is too small for the ellipsis to fit, so ellipsis_w will remain 0. reported by Bakkeby <bakkeby@gmail.com> ref. https://git.suckless.org/dmenu/commit/e4827b0c4048718ab06670cf60ef68d028fe7fc4.html
This commit is contained in:
parent
4ceaa81c0d
commit
4b832e8917
2
drw.c
2
drw.c
@ -448,7 +448,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||
const char *ellipsis = "...";
|
||||
static unsigned int ellipsis_width = 0;
|
||||
|
||||
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
|
||||
if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts)
|
||||
return 0;
|
||||
|
||||
if (!render) {
|
||||
|
Loading…
Reference in New Issue
Block a user