Skip to content

Commit bac1911

Browse files
committed
system tables foo
1 parent 74d36bd commit bac1911

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

uefi/src/table/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ pub unsafe fn set_system_table(ptr: *const uefi_raw::table::system::SystemTable)
4242
/// [`exit_boot_services`]: SystemTable::exit_boot_services
4343
pub fn system_table_boot() -> Option<SystemTable<Boot>> {
4444
let st = SYSTEM_TABLE.load(Ordering::Acquire);
45-
assert!(!st.is_null());
45+
46+
if st.is_null() {
47+
return None;
48+
}
4649

4750
// SAFETY: the system table is valid per the requirements of `set_system_table`.
4851
unsafe {
@@ -62,7 +65,10 @@ pub fn system_table_boot() -> Option<SystemTable<Boot>> {
6265
/// Panics if the system table has not been set with [`set_system_table`].
6366
pub fn system_table_runtime() -> Option<SystemTable<Runtime>> {
6467
let st = SYSTEM_TABLE.load(Ordering::Acquire);
65-
assert!(!st.is_null());
68+
69+
if st.is_null() {
70+
return None;
71+
}
6672

6773
// SAFETY: the system table is valid per the requirements of `set_system_table`.
6874
unsafe {

0 commit comments

Comments
 (0)