summaryrefslogtreecommitdiff
path: root/sys/src/cmd/mothra/libpanel
diff options
context:
space:
mode:
authorppatience0 <ppatience0@gmail.com>2013-05-27 00:26:19 -0400
committerppatience0 <ppatience0@gmail.com>2013-05-27 00:26:19 -0400
commit6a0d21acca616aa4cf11468e3dc6f1c052e1d94f (patch)
treedcdf99efc6323a8f9a683a9479ff32c71dcb8382 /sys/src/cmd/mothra/libpanel
parentffef3278efa4b923b29005c881e23385f46b3222 (diff)
mothra: clicking on the url scroll bar, snarfing, or saving a hit when no urls have been loaded (right after running mothra) would crash. this was due to use of w->url and selection when they are actually nil.
to fix this, make genwww return 0 if w->url is nil and output an error message when attempting to access selection if it's nil. the problem with the w->url fix is that after clicking on the url scroll bar, an empty url history row could be highlighted by clicking on it. fix this by making sure lp->lo is not less than zero.
Diffstat (limited to 'sys/src/cmd/mothra/libpanel')
-rw-r--r--sys/src/cmd/mothra/libpanel/list.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/src/cmd/mothra/libpanel/list.c b/sys/src/cmd/mothra/libpanel/list.c
index fb9b676f7..8f4b0766f 100644
--- a/sys/src/cmd/mothra/libpanel/list.c
+++ b/sys/src/cmd/mothra/libpanel/list.c
@@ -22,7 +22,7 @@ void pl_listsel(Panel *p, int sel, int on){
Rectangle r;
lp=p->data;
hi=lp->lo+(lp->listr.max.y-lp->listr.min.y)/font->height;
- if(lp->lo<=sel && sel<hi && sel<lp->len){
+ if(lp->lo>=0 && lp->lo<=sel && sel<hi && sel<lp->len){
r=lp->listr;
r.min.y+=(sel-lp->lo)*font->height;
r.max.y=r.min.y+font->height;