[core] fix Boot selection dropdown not being reset on unsupported images

* Closes #1903
This commit is contained in:
Pete Batard 2022-04-15 11:43:22 +01:00
parent d029551929
commit f5abae6442
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
2 changed files with 12 additions and 10 deletions

View file

@ -1289,6 +1289,13 @@ DWORD WINAPI ImageScanThread(LPVOID param)
(img_report.image_size == 0) ||
(!img_report.is_iso && (img_report.is_bootable_img <= 0) && !img_report.is_windows_img)) {
// Failed to scan image
if (img_report.is_bootable_img < 0)
MessageBoxExU(hMainDialog, lmprintf(MSG_325, image_path), lmprintf(MSG_042), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
else
MessageBoxExU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK | MB_ICONINFORMATION | MB_IS_RTL, selected_langid);
// Make sure to relinquish image_path before we call UpdateImage
// otherwise the boot selection dropdown won't be properly reset.
safe_free(image_path);
SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0);
UpdateImage(FALSE);
SetMBRProps();
@ -1296,11 +1303,6 @@ DWORD WINAPI ImageScanThread(LPVOID param)
PrintInfoDebug(0, MSG_203);
PrintStatus(0, MSG_203);
EnableControls(TRUE, FALSE);
if (img_report.is_bootable_img < 0)
MessageBoxExU(hMainDialog, lmprintf(MSG_325, image_path), lmprintf(MSG_042), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
else
MessageBoxExU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK | MB_ICONINFORMATION | MB_IS_RTL, selected_langid);
safe_free(image_path);
goto out;
}