Commit d2dbed4c authored by Pierre Ynard's avatar Pierre Ynard

ncurses: fix crashes when switching boxes

parent ed37a76f
...@@ -1485,7 +1485,7 @@ static bool HandleBrowseKey(intf_thread_t *p_intf, int key) ...@@ -1485,7 +1485,7 @@ static bool HandleBrowseKey(intf_thread_t *p_intf, int key)
playlist_Add(p_playlist, psz_uri, NULL, PLAYLIST_APPEND, playlist_Add(p_playlist, psz_uri, NULL, PLAYLIST_APPEND,
PLAYLIST_END, p_parent->p_input == p_input, false); PLAYLIST_END, p_parent->p_input == p_input, false);
p_sys->i_box_type = BOX_PLAYLIST; BoxSwitch(p_sys, BOX_PLAYLIST);
free(psz_uri); free(psz_uri);
return true; return true;
} }
...@@ -1625,13 +1625,24 @@ static void HandleCommonKey(intf_thread_t *p_intf, int key) ...@@ -1625,13 +1625,24 @@ static void HandleCommonKey(intf_thread_t *p_intf, int key)
case '/': /* Search */ case '/': /* Search */
p_sys->psz_search_chain[0] = '\0'; p_sys->psz_search_chain[0] = '\0';
p_sys->b_plidx_follow = false; p_sys->b_plidx_follow = false;
if (p_sys->i_box_type == BOX_PLAYLIST)
{
p_sys->i_before_search = p_sys->i_box_idx; p_sys->i_before_search = p_sys->i_box_idx;
p_sys->i_box_type = BOX_SEARCH; p_sys->i_box_type = BOX_SEARCH;
}
else
{
p_sys->i_before_search = 0;
BoxSwitch(p_sys, BOX_SEARCH);
}
return; return;
case 'A': /* Open */ case 'A': /* Open */
p_sys->psz_open_chain[0] = '\0'; p_sys->psz_open_chain[0] = '\0';
if (p_sys->i_box_type == BOX_PLAYLIST)
p_sys->i_box_type = BOX_OPEN; p_sys->i_box_type = BOX_OPEN;
else
BoxSwitch(p_sys, BOX_OPEN);
return; return;
/* Navigation */ /* Navigation */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment