summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2010-02-23 21:30:16 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2010-02-23 21:30:16 +0000
commit9d268d796c9ebf9ad0863648265838b018aac4cd (patch)
tree6ecd20335e9eff8796173d9799a0f71b34f76048
parent614fb41ddb3b0d6cacf31116a79646a6af016bad (diff)
downloadrockbox-9d268d796c9ebf9ad0863648265838b018aac4cd.tar.gz
rockbox-9d268d796c9ebf9ad0863648265838b018aac4cd.tar.bz2
rockbox-9d268d796c9ebf9ad0863648265838b018aac4cd.zip
Quickscreen: Hande case where not all quick settings are defines
This happens in Archos Recorder, see quick_screen_f3(), which caused crash (FS#11037), due to top item not defined. The commit explicitly sets items[QUICKSCREEN_TOP] to NULL, and also draws an arrow only if the item is defined. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24871 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/quickscreen.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c
index 6675407795..3a35b24f35 100644
--- a/apps/gui/quickscreen.c
+++ b/apps/gui/quickscreen.c
@@ -201,17 +201,26 @@ static void gui_quickscreen_draw(const struct gui_quickscreen *qs,
/* draw the icons */
display->set_viewport(vp_icons);
- display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow],
- (vp_icons->width/2) - 4, 0, 7, 8);
- display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
- vp_icons->width - 8,
- (vp_icons->height/2) - 4, 7, 8);
- display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 0,
- (vp_icons->height/2) - 4, 7, 8);
-
- display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
- (vp_icons->width/2) - 4,
- vp_icons->height - 8, 7, 8);
+ if (qs->items[QUICKSCREEN_TOP] != NULL)
+ {
+ display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow],
+ (vp_icons->width/2) - 4, 0, 7, 8);
+ }
+ if (qs->items[QUICKSCREEN_RIGHT] != NULL)
+ {
+ display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
+ vp_icons->width - 8, (vp_icons->height/2) - 4, 7, 8);
+ }
+ if (qs->items[QUICKSCREEN_LEFT] != NULL)
+ {
+ display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward],
+ 0, (vp_icons->height/2) - 4, 7, 8);
+ }
+ if (qs->items[QUICKSCREEN_BOTTOM] != NULL)
+ {
+ display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
+ (vp_icons->width/2) - 4, vp_icons->height - 8, 7, 8);
+ }
display->set_viewport(parent);
display->update_viewport();
@@ -220,12 +229,13 @@ static void gui_quickscreen_draw(const struct gui_quickscreen *qs,
static void talk_qs_option(const struct settings_list *opt, bool enqueue)
{
- if (global_settings.talk_menu) {
- if (!enqueue)
- talk_shutup();
- talk_id(opt->lang_id, true);
- option_talk_value(opt, option_value_as_int(opt), true);
- }
+ if (!global_settings.talk_menu || !opt)
+ return;
+
+ if (!enqueue)
+ talk_shutup();
+ talk_id(opt->lang_id, true);
+ option_talk_value(opt, option_value_as_int(opt), true);
}
/*
@@ -409,6 +419,7 @@ bool quick_screen_quick(int button_enter)
bool quick_screen_f3(int button_enter)
{
struct gui_quickscreen qs;
+ qs.items[QUICKSCREEN_TOP] = NULL;
qs.items[QUICKSCREEN_LEFT] =
find_setting(&global_settings.scrollbar, NULL);
qs.items[QUICKSCREEN_RIGHT] =