Fix rare crash seen when dereferencing backgroundIcon[NONE].

Because backgroundIcon[] is not initialized by the ScreenRecoveryUI
constructor, it should be initialized explicitly to NULL in Init().

If it is not initialized, ScreenRecoveryUI::SetBackground() can fail
for the NONE icon because the NULL test can fail and junk will be
dereferenced.

Change-Id: I4e3738d2e241ed90df43c984fb41e0072933f50a
This commit is contained in:
Alistair Strachan
2013-11-18 09:51:32 -08:00
committed by Doug Zongker
parent 9690e2b370
commit 9b8ae8038b
+1
View File
@@ -376,6 +376,7 @@ void ScreenRecoveryUI::Init()
text_cols = gr_fb_width() / char_width;
if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1;
backgroundIcon[NONE] = NULL;
LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]);
backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
LoadBitmap("icon_error", &backgroundIcon[ERROR]);