From 0a3f4c3575a70f43e35426e62d18620b2d394392 Mon Sep 17 00:00:00 2001 From: Sergey Isakov Date: Mon, 6 Apr 2020 18:40:45 +0300 Subject: [PATCH] fix uninitialized disk type Signed-off-by: Sergey Isakov --- rEFIt_UEFI/entry_scan/common.cpp | 18 ++++++++++-------- rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp | 6 ++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/rEFIt_UEFI/entry_scan/common.cpp b/rEFIt_UEFI/entry_scan/common.cpp index 2d1957d155..e91b4e68c5 100644 --- a/rEFIt_UEFI/entry_scan/common.cpp +++ b/rEFIt_UEFI/entry_scan/common.cpp @@ -138,26 +138,28 @@ EG_IMAGE* ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI_DE break; } #if USE_XTHEME - IconX = &ThemeX.GetIcon(IconNum); - if (IconX->isEmpty()) { - IconX = &ThemeX.GetIcon(BUILTIN_ICON_VOL_INTERNAL); - } break; case DISK_KIND_EXTERNAL: - IconX = &ThemeX.GetIcon(BUILTIN_ICON_VOL_EXTERNAL); + IconNum = BUILTIN_ICON_VOL_EXTERNAL; break; case DISK_KIND_OPTICAL: - IconX = &ThemeX.GetIcon(BUILTIN_ICON_VOL_OPTICAL); + IconNum = BUILTIN_ICON_VOL_OPTICAL; break; case DISK_KIND_FIREWIRE: - IconX = &ThemeX.GetIcon(BUILTIN_ICON_VOL_FIREWIRE); + IconNum = BUILTIN_ICON_VOL_FIREWIRE; break; case DISK_KIND_BOOTER: - IconX = &ThemeX.GetIcon(BUILTIN_ICON_VOL_BOOTER); + IconNum = BUILTIN_ICON_VOL_BOOTER; break; default: + IconNum = BUILTIN_ICON_VOL_INTERNAL; break; } + IconX = &ThemeX.GetIcon(IconNum); + if (IconX->isEmpty()) { + IconX = &ThemeX.GetIcon(BUILTIN_ICON_VOL_INTERNAL); //including embedded which is really present + } + return *IconX; #else return BuiltinIcon(IconNum); diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp index 85d720c8bc..1f57684c6f 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp @@ -1153,12 +1153,14 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT SetNextScreenMode(1); egGetScreenSize(&UGAWidth, &UGAHeight); //before init theme InitTheme(FALSE, NULL); + MenuExit = MENU_EXIT_ESCAPE; //to redraw screen break; case SCAN_F10: egScreenShot(); break; case SCAN_F11: - ResetNvram (); + ResetNvram(); + MenuExit = MENU_EXIT_ESCAPE; //to redraw screen break; case SCAN_F12: MenuExit = MENU_EXIT_EJECT; @@ -1547,7 +1549,7 @@ INTN REFIT_MENU_SCREEN::DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INT return TextWidth2; } -void REFIT_MENU_SCREEN::EraseTextXY() +void REFIT_MENU_SCREEN::EraseTextXY() //used on boot screen { OldTextBufferImage.Draw(OldTextBufferRect.XPos, OldTextBufferRect.YPos); }