libdraw: handle displayless font access
[rsc] --rw-rw-r-- M 898628 glenda sys 4179 Mar 20 08:53 sys/src/libdraw/alloc.c
/n/sourcesdump/2006/0320/plan9/sys/src/libdraw/alloc.c:201,207 -
/n/sourcesdump/2006/0321/plan9/sys/src/libdraw/alloc.c:201,207
Display *d;
Image *w;
- if(i == 0)
+ if(i == 0 || i->display == 0)
return 0;
/* make sure no refresh events occur on this if we block in the write */
d = i->display;
[rsc] --rw-rw-r-- M 898628 glenda sys 9108 Mar 20 08:53 sys/src/libdraw/init.c
/n/sourcesdump/2006/0320/plan9/sys/src/libdraw/init.c:419,424 -
/n/sourcesdump/2006/0321/plan9/sys/src/libdraw/init.c:419,426
int
flushimage(Display *d, int visible)
{
+ if(d == nil)
+ return 0;
if(visible){
*d->bufp++ = 'v'; /* five bytes always reserved for this */
if(d->_isnewdisplay){
[rsc] --rw-rw-r-- M 898628 glenda sys 1054 Mar 20 08:53 sys/src/libdraw/readsubfont.c
/n/sourcesdump/2006/0320/plan9/sys/src/libdraw/readsubfont.c:54,60 -
/n/sourcesdump/2006/0321/plan9/sys/src/libdraw/readsubfont.c:54,60
}
Subfont*
- readsubfont(Display*d, char *name, int fd, int dolock)
+ readsubfont(Display *d, char *name, int fd, int dolock)
{
return readsubfonti(d, name, fd, nil, dolock);
}
|