diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-04 21:12:20 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-04 21:12:20 +0200 |
commit | a66a6731e79248b859e364178c2d962355cba3ea (patch) | |
tree | 13dcb484a6ccb4fff934f99b9b4cbf1799a6a484 /src | |
parent | 099aa4c9f0a6846dcea8e0026c9067bc00f643cc (diff) |
Fixed a couple of undefined behaviors
Conditions depending on uninitialized memory. Benign, though.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/listwidget.c | 1 | ||||
-rw-r--r-- | src/ui/scrollwidget.c | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/ui/listwidget.c b/src/ui/listwidget.c index 2e5519a5..e7b4fc22 100644 --- a/src/ui/listwidget.c +++ b/src/ui/listwidget.c | |||
@@ -67,6 +67,7 @@ void init_ListWidget(iListWidget *d) { | |||
67 | addChild_Widget(w, iClob(d->scroll = new_ScrollWidget())); | 67 | addChild_Widget(w, iClob(d->scroll = new_ScrollWidget())); |
68 | setThumb_ScrollWidget(d->scroll, 0, 0); | 68 | setThumb_ScrollWidget(d->scroll, 0, 0); |
69 | d->scrollY = 0; | 69 | d->scrollY = 0; |
70 | d->itemHeight = 0; | ||
70 | init_PtrArray(&d->items); | 71 | init_PtrArray(&d->items); |
71 | d->hoverItem = iInvalidPos; | 72 | d->hoverItem = iInvalidPos; |
72 | init_Click(&d->click, d, SDL_BUTTON_LEFT); | 73 | init_Click(&d->click, d, SDL_BUTTON_LEFT); |
diff --git a/src/ui/scrollwidget.c b/src/ui/scrollwidget.c index e1893fec..e887ddbf 100644 --- a/src/ui/scrollwidget.c +++ b/src/ui/scrollwidget.c | |||
@@ -75,7 +75,9 @@ static iRect thumbRect_ScrollWidget_(const iScrollWidget *d) { | |||
75 | } | 75 | } |
76 | 76 | ||
77 | static void checkVisible_ScrollWidget_(iScrollWidget *d) { | 77 | static void checkVisible_ScrollWidget_(iScrollWidget *d) { |
78 | setFlags_Widget(as_Widget(d), hidden_WidgetFlag, height_Rect(thumbRect_ScrollWidget_(d)) == 0); | 78 | setFlags_Widget(as_Widget(d), |
79 | hidden_WidgetFlag, | ||
80 | d->thumbSize != 0 ? height_Rect(thumbRect_ScrollWidget_(d)) == 0 : iTrue); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | void setRange_ScrollWidget(iScrollWidget *d, iRangei range) { | 83 | void setRange_ScrollWidget(iScrollWidget *d, iRangei range) { |