libthread: input sanity checks

This commit is contained in:
Russ Cox 2008-05-05 23:08:35 -04:00
parent 118dfa98b8
commit 80f2165d27

View file

@ -96,9 +96,8 @@ altcanexec(Alt *a)
_Altarray *ar;
Channel *c;
if(a->op == CHANNOP)
if(a->op == CHANNOP || (c=a->c) == nil)
return 0;
c = a->c;
if(c->bufsize == 0){
ar = chanarray(c, otherop(a->op));
return ar && ar->n;
@ -119,6 +118,8 @@ altqueue(Alt *a)
{
_Altarray *ar;
if(a->c == nil)
return;
ar = chanarray(a->c, a->op);
addarray(ar, a);
}