Don't panic if BootCurrent is not found

This commit is contained in:
Lauri Kenttä
2024-06-13 15:50:19 +03:00
parent c826149183
commit 90fb8e47c1
+3 -3
View File
@@ -113,10 +113,10 @@ public class EfiBootEntries {
cache = new Dictionary<UInt16, (Efi.Variable, BootEntryData)>(); cache = new Dictionary<UInt16, (Efi.Variable, BootEntryData)>();
BootOrder = Efi.GetVariable("BootOrder"); BootOrder = Efi.GetVariable("BootOrder");
BootCurrent = Efi.GetVariable("BootCurrent"); BootCurrent = Efi.GetVariable("BootCurrent");
if (BootOrder.Data == null || BootCurrent.Data == null) { if (BootOrder.Data == null) {
throw new Exception("Could not read BootOrder or BootCurrent."); throw new Exception("Could not read BootOrder.");
} }
BootCurrentInts = new List<UInt16>(Efi.BytesToUInt16s(BootCurrent.Data)); BootCurrentInts = new List<UInt16>(Efi.BytesToUInt16s(BootCurrent.Data ?? new byte[0]));
BootOrderInts = new List<UInt16>(Efi.BytesToUInt16s(BootOrder.Data)); BootOrderInts = new List<UInt16>(Efi.BytesToUInt16s(BootOrder.Data));
} }