load_plugin_screen(): handle all plugin_load() return values

Fixes crashes when pictureflow returns PLUGIN_GOTO_WPS

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27965 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2010-09-01 14:12:14 +00:00
parent ff8089789b
commit 21c7b9debb

View file

@ -558,9 +558,19 @@ static int load_plugin_screen(char *plug_path)
global_status.last_screen = (char)next_screen;
status_save();
ret_val = plugin_load(plug_path, NULL);
if (ret_val == PLUGIN_OK)
switch (plugin_load(plug_path, NULL))
{
case PLUGIN_GOTO_WPS:
ret_val = GO_TO_WPS;
break;
case PLUGIN_OK:
ret_val = audio_status() ? GO_TO_PREVIOUS : GO_TO_ROOT;
break;
default:
ret_val = GO_TO_PREVIOUS;
break;
}
if (ret_val == GO_TO_PREVIOUS)
last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous;
return ret_val;