diff --git a/src/toolkit.c b/src/toolkit.c index 12807c2..5ce8b2d 100644 --- a/src/toolkit.c +++ b/src/toolkit.c @@ -1031,8 +1031,14 @@ static void toolkit_listScroll(Widget* wgt, int direction) { // List mouse even focus. static void toolkit_listFocus(Widget* lst, double bx, double by) { (void)bx; - lst->dat.lst.selected = (lst->h - by) / (gl_defFont.h+2.); - toolkit_listScroll(lst, 0); // Check boundaries and trigger callback. + int i; + + i = (lst->h - by) / (gl_defFont.h + 2.); + if(i< lst->dat.lst.noptions) { + // Should not be out of boundaries. + lst->dat.lst.selected = i; + toolkit_listScroll(lst, 0); // Check boundaries and trigger callback. + } } char* toolkit_getList(const unsigned int wid, char* name) {