1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 04:13:01 +01:00

fix for possible divsion by zero

This commit is contained in:
Jfreegman 2013-12-02 18:34:14 -05:00
parent 7a89229375
commit ba750753a5

View File

@ -276,6 +276,10 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
wattroff(self->window, COLOR_PAIR(CYAN) | A_BOLD); wattroff(self->window, COLOR_PAIR(CYAN) | A_BOLD);
} }
if ((y2 - FLIST_OFST) == 0) /* don't allow division by zero */
return;
/* Determine which portion of friendlist to draw based on current position */ /* Determine which portion of friendlist to draw based on current position */
int page = num_selected / (y2 - FLIST_OFST); int page = num_selected / (y2 - FLIST_OFST);
int start = (y2 - FLIST_OFST) * page; int start = (y2 - FLIST_OFST) * page;