--- hatari/src/gui-sdl/sdlgui.c 2019/04/09 08:50:37 1.1.1.11 +++ hatari/src/gui-sdl/sdlgui.c 2019/04/09 08:52:16 1.1.1.12 @@ -620,6 +620,7 @@ void SDLGui_DrawDialog(const SGOBJ *dlg) /*-----------------------------------------------------------------------*/ /** * Search an object at a certain position. + * Return object index or -1 if it wasn't found. */ static int SDLGui_FindObj(const SGOBJ *dlg, int fx, int fy) { @@ -738,7 +739,7 @@ int SDLGui_DoDialog(SGOBJ *dlg, SDL_Even /* If current object is the scrollbar, and mouse is still down, we can scroll it */ /* also if the mouse pointer has left the scrollbar */ - if (dlg[current_object].type == SGSCROLLBAR) { + if (current_object >= 0 && dlg[current_object].type == SGSCROLLBAR) { if (b & SDL_BUTTON(1)) { obj = current_object; dlg[obj].state |= SG_MOUSEDOWN;