From 90fb8e47c11f77c4d7db628c03c47ad79a93bc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20Kentt=C3=A4?= Date: Fri, 17 May 2024 23:13:19 +0300 Subject: [PATCH] Don't panic if BootCurrent is not found --- src/EfiBootEntries.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EfiBootEntries.cs b/src/EfiBootEntries.cs index 3cbc935..f835f30 100644 --- a/src/EfiBootEntries.cs +++ b/src/EfiBootEntries.cs @@ -113,10 +113,10 @@ public class EfiBootEntries { cache = new Dictionary(); 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(Efi.BytesToUInt16s(BootCurrent.Data)); + BootCurrentInts = new List(Efi.BytesToUInt16s(BootCurrent.Data ?? new byte[0])); BootOrderInts = new List(Efi.BytesToUInt16s(BootOrder.Data)); }