From be91342733fd56d1e7bafe72e82a8ac4dc67b79d Mon Sep 17 00:00:00 2001 From: kasull Date: Tue, 3 Mar 2026 18:49:43 -0500 Subject: fix use after free --- src/editor/view3d.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/editor/view3d.cpp') diff --git a/src/editor/view3d.cpp b/src/editor/view3d.cpp index 3729823..292760a 100644 --- a/src/editor/view3d.cpp +++ b/src/editor/view3d.cpp @@ -48,7 +48,7 @@ void gui_editor_3dview_draw_showpos( GUI_EDITOR_3DVIEW* view ) { void gui_editor_3dview_draw_fn( void* ptr ) { GUI_EDITOR_3DVIEW* view = (GUI_EDITOR_3DVIEW*)ptr; - if( !objl->pl ) + if( !editor || !editor->map || !objl->pl ) return; I32 x = gui_relx( view ); @@ -82,6 +82,9 @@ void gui_editor_3dview_draw_fn( void* ptr ) { void gui_editor_3dview_input_fn( void* ptr ) { GUI_EDITOR_3DVIEW* view = (GUI_EDITOR_3DVIEW*)ptr; + if( !editor || !editor->map ) + return; + if( !input.mouselock ) gui_base_input_fn( view ); @@ -108,6 +111,9 @@ void gui_editor_3dview_create_toolbar( GUI_EDITOR_3DVIEW* view ) { I32 x = 1, y = view->h - 4; gui_button( x, y, 90, 18, "compile bsp", pfn( void* b ) { + if( !editor || !editor->map ) + return; + if( editor->map->bsp ) bsp_free( editor->map->bsp ); bsp_build_map( editor->map ); -- cgit v1.2.3