mirror of
https://github.com/mintycube/st.git
synced 2024-10-22 14:05:49 +02:00
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:
parent
fdae39e8b8
commit
9b463ac36d
4
x.c
4
x.c
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user