1
1

DRW: DebugDraw: Fix unguarded drw_debug_draw()

This might create nullptr dereference in some cases.
This commit is contained in:
2022-08-09 23:04:58 +02:00
parent 11bdc321a2
commit a9a7460570
2 changed files with 4 additions and 1 deletions

View File

@@ -595,11 +595,13 @@ blender::draw::DebugDraw *DRW_debug_get()
void drw_debug_draw()
{
if (!GPU_shader_storage_buffer_objects_support()) {
#ifdef DEBUG
if (!GPU_shader_storage_buffer_objects_support() || DST.debug == nullptr) {
return;
}
/* TODO(fclem): Convenience for now. Will have to move to DRWManager. */
reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->display_to_view();
#endif
}
/**

View File

@@ -3029,6 +3029,7 @@ void DRW_engines_free(void)
DRW_globals_free();
drw_debug_module_free(DST.debug);
DST.debug = NULL;
DRW_UBO_FREE_SAFE(G_draw.block_ubo);
DRW_UBO_FREE_SAFE(G_draw.view_ubo);