Database: Fix possible crash
The File Browser and Database apparently share the same selected_item_history, which means that selected_item can be -1 even in the context of the database, This leads to tree_get_file_position being called in id3db mode, which isn't safe to do. Change-Id: I46151e8a823afab0b57ad839cde13f6072b8917b
This commit is contained in:
parent
b4e7c60c6d
commit
246152a671
1 changed files with 5 additions and 2 deletions
|
@ -392,8 +392,11 @@ static int update_dir(void)
|
||||||
/* if selected item is undefined */
|
/* if selected item is undefined */
|
||||||
if (tc.selected_item == -1)
|
if (tc.selected_item == -1)
|
||||||
{
|
{
|
||||||
/* use lastfile to determine the selected item */
|
#ifdef HAVE_TAGCACHE
|
||||||
tc.selected_item = tree_get_file_position(lastfile);
|
if (!id3db)
|
||||||
|
#endif
|
||||||
|
/* use lastfile to determine the selected item */
|
||||||
|
tc.selected_item = tree_get_file_position(lastfile);
|
||||||
|
|
||||||
/* If the file doesn't exists, select the first one (default) */
|
/* If the file doesn't exists, select the first one (default) */
|
||||||
if(tc.selected_item < 0)
|
if(tc.selected_item < 0)
|
||||||
|
|
Loading…
Reference in a new issue