summaryrefslogtreecommitdiffstats
path: root/Panel.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2011-09-08 03:38:48 +0000
committerHisham Muhammad <hisham@gobolinux.org>2011-09-08 03:38:48 +0000
commit5a8307a10b33e3cbc668d26d2711bcc26aa35f0f (patch)
treea827dfdedd251393e7a286188f12f7d77db1f8fe /Panel.c
parent978019d34f71c08393d44f66a1ab71ccc5008ff1 (diff)
Fix panel inconsistency that could lead to crashes. Closes #2422267.
Diffstat (limited to 'Panel.c')
-rw-r--r--Panel.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/Panel.c b/Panel.c
index 4398c0ea..5da79092 100644
--- a/Panel.c
+++ b/Panel.c
@@ -238,18 +238,11 @@ void Panel_setSelected(Panel* this, int selected) {
void Panel_draw(Panel* this, bool focus) {
assert (this != NULL);
- int first, last;
int itemCount = Vector_size(this->items);
int scrollH = this->scrollH;
int y = this->y; int x = this->x;
- first = this->scrollV;
-
- if (this->h > itemCount) {
- last = this->scrollV + itemCount;
- move(y + last, x + 0);
- } else {
- last = MIN(itemCount, this->scrollV + this->h);
- }
+ int first = this->scrollV;
+ int last = MIN(itemCount, this->scrollV + MIN(itemCount, this->h));
if (this->selected < first) {
first = this->selected;
this->scrollV = first;

© 2014-2024 Faster IT GmbH | imprint | privacy policy