Unit list search: reset cursor position to 0 before switching pages

On empty lists, pressing "up" sets the cursor position to -1. This results in a
crash if the list is populated, which the search plugin does before switching
pages.

Fixes #928
develop
lethosor 2016-05-17 23:23:54 -04:00
parent a8f9f912c9
commit d198bf547a
1 changed files with 3 additions and 0 deletions

@ -1160,6 +1160,9 @@ private:
if (!in_entry_mode())
{
// Changing screens, reset search
int32_t *cursor_pos = get_viewscreen_cursor();
if (cursor_pos && *cursor_pos < 0)
*cursor_pos = 0;
clear_search();
reset_all();
}