sixel: prevent crashing when size is zero (#129)

Crashing happens when you zoom out and the width or height of an image
becomes zero.
This commit is contained in:
veltza 2024-04-02 21:05:32 +03:00 committed by GitHub
parent fdae39e8b8
commit 9b463ac36d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

4
x.c
View File

@ -3145,8 +3145,8 @@ xfinishdraw(void)
continue; continue;
/* scale the image */ /* scale the image */
width = im->width * win.cw / im->cw; width = MAX(im->width * win.cw / im->cw, 1);
height = im->height * win.ch / im->ch; height = MAX(im->height * win.ch / im->ch, 1);
if (!im->pixmap) { if (!im->pixmap) {
im->pixmap = (void *)XCreatePixmap(xw.dpy, xw.win, width, height, im->pixmap = (void *)XCreatePixmap(xw.dpy, xw.win, width, height,
#if ALPHA_PATCH #if ALPHA_PATCH