diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-01-12 00:07:27 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-01-12 00:07:27 +0100 |
commit | 16784a2e45937c6d4df5fe21c0838f8a7dfeb0a7 (patch) | |
tree | 7e29e34080c74dfa5f4dc0d09943d739d4b0584d | |
parent | 5254e41f6bad708fb3d2cc4e98a416d3efa36eb2 (diff) |
devdraw: fix topnwindows() panic when images are not windows (thanks aiju)
Crashes drawterm and native:
#include <u.h>
#include <libc.h>
#include <draw.h>
void
main(int argc, char **argv)
{
initdraw(nil, nil, nil);
Image *a[] = {screen, display->black};
topnwindows(a, nelem(a));
flushimage(display, 1);
}
-rw-r--r-- | sys/src/9/port/devdraw.c | 8 |
1 files 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; j<nw; j++) + for(j=0; j<nw; j++){ lp[j] = drawimage(client, a+1+1+2+j*4); - if(lp[0]->layer == 0) - error("images are not windows"); - for(j=1; j<nw; j++) + if(lp[j]->layer == 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 |