From 16784a2e45937c6d4df5fe21c0838f8a7dfeb0a7 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 12 Jan 2020 00:07:27 +0100 Subject: devdraw: fix topnwindows() panic when images are not windows (thanks aiju) Crashes drawterm and native: #include #include #include void main(int argc, char **argv) { initdraw(nil, nil, nil); Image *a[] = {screen, display->black}; topnwindows(a, nelem(a)); flushimage(display, 1); } --- sys/src/9/port/devdraw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/src/9/port/devdraw.c b/sys/src/9/port/devdraw.c index c9b8be2e3..259d6ddf3 100644 --- a/sys/src/9/port/devdraw.c +++ b/sys/src/9/port/devdraw.c @@ -2022,13 +2022,13 @@ drawmesg(Client *client, void *av, int n) free(lp); nexterror(); } - for(j=0; jlayer == 0) - error("images are not windows"); - for(j=1; jlayer == 0) + error("images are not windows"); if(lp[j]->layer->screen != lp[0]->layer->screen) error("images not on same screen"); + } if(a[1]) memltofrontn(lp, nw); else -- cgit v1.2.3