mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-19 05:40:01 +10:00
utitilities: Add NVRAM error handling
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
- Ensure Apple Silicon-specific installers are not listed
|
- Ensure Apple Silicon-specific installers are not listed
|
||||||
- ie. M2 specific build (21F2092)
|
- ie. M2 specific build (21F2092)
|
||||||
- Avoid adding OpenCore icon in boot picker if Windows bootloader on same partition
|
- Avoid adding OpenCore icon in boot picker if Windows bootloader on same partition
|
||||||
|
- Add error-handling to corrupt/non-standard NVRAM variables
|
||||||
|
|
||||||
## 0.4.7
|
## 0.4.7
|
||||||
- Fix crashing on defaults parsing
|
- Fix crashing on defaults parsing
|
||||||
|
|||||||
@@ -346,7 +346,12 @@ def get_nvram(variable: str, uuid: str = None, *, decode: bool = False):
|
|||||||
|
|
||||||
if decode:
|
if decode:
|
||||||
if isinstance(value, bytes):
|
if isinstance(value, bytes):
|
||||||
value = value.strip(b"\0").decode()
|
try:
|
||||||
|
value = value.strip(b"\0").decode()
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
# Some sceanrios the firmware will throw garbage in
|
||||||
|
# ie. iMac12,2 with FireWire boot-path
|
||||||
|
value = None
|
||||||
elif isinstance(value, str):
|
elif isinstance(value, str):
|
||||||
value = value.strip("\0")
|
value = value.strip("\0")
|
||||||
return value
|
return value
|
||||||
|
|||||||
Reference in New Issue
Block a user