kernel: Don't crash when all windows are closed

This commit is contained in:
Ry 2022-12-28 00:05:15 -08:00
parent 1d70da41a9
commit 1e6e925d08

View File

@ -202,6 +202,8 @@ destroy_window:
; set the active window to whatever entry is found first ; set the active window to whatever entry is found first
call search_for_nonempty_window_list_entry call search_for_nonempty_window_list_entry
mov.8 [active_window_offset], r0 mov.8 [active_window_offset], r0
cmp r0, 0xFFFFFFFF
ifz jmp destroy_window_no_more_windows
; set the menu bar for the newly active window ; set the menu bar for the newly active window
call window_list_offset_to_struct call window_list_offset_to_struct
@ -214,6 +216,12 @@ destroy_window:
cmp r0, 0 cmp r0, 0
ifnz call draw_menu_bar_root_items ifnz call draw_menu_bar_root_items
pop r1
pop r0
ret
destroy_window_no_more_windows:
call disable_menu_bar
pop r1 pop r1
pop r0 pop r0
ret ret