Don't panic if BootCurrent is not found

This commit is contained in:
Lauri Kenttä
2024-05-17 23:13:19 +03:00
parent c826149183
commit 90fb8e47c1

View File

@@ -113,10 +113,10 @@ public class EfiBootEntries {
cache = new Dictionary<UInt16, (Efi.Variable, BootEntryData)>();
BootOrder = Efi.GetVariable("BootOrder");
BootCurrent = Efi.GetVariable("BootCurrent");
if (BootOrder.Data == null || BootCurrent.Data == null) {
throw new Exception("Could not read BootOrder or BootCurrent.");
if (BootOrder.Data == null) {
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));
}