summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2011-10-05 04:48:31 +0200
committercinap_lenrek <cinap_lenrek@centraldogma>2011-10-05 04:48:31 +0200
commit2fdb279101563f0e72a11a83e29c40ccda924667 (patch)
treecd1fd85627e1046b0cdb1b8bc0db93312804f4e4
parent51c7856350c5c542269f01cf98a7385adbe515a1 (diff)
downloadplan9front-2fdb279101563f0e72a11a83e29c40ccda924667.tar.xz
mothra: fix nil pointer crash
-rw-r--r--sys/src/cmd/mothra/mothra.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c
index d85c52c27..039a05aca 100644
--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -137,12 +137,14 @@ void adjkb(void){
Rtext *t;
int yoffs;
extern Panel *pl_kbfocus; /* this is a secret panel library name */
- yoffs=text->r.min.y-plgetpostextview(text);
- for(t=current->text;t;t=t->next) if(!eqrect(t->r, Rect(0,0,0,0))){
- if(t->r.max.y+yoffs>text->r.max.y) break;
- if(t->r.min.y+yoffs>=text->r.min.y
- && t->b==0
- && subpanel(t->p, pl_kbfocus)) return;
+ if(current){
+ yoffs=text->r.min.y-plgetpostextview(text);
+ for(t=current->text;t;t=t->next) if(!eqrect(t->r, Rect(0,0,0,0))){
+ if(t->r.max.y+yoffs>text->r.max.y) break;
+ if(t->r.min.y+yoffs>=text->r.min.y
+ && t->b==0
+ && subpanel(t->p, pl_kbfocus)) return;
+ }
}
plgrabkb(cmd);
}