From b31d95ed4f97216b90b52426f7bda868f4a64c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alessandro=20Fam=C3=A0?= Date: Sat, 19 Aug 2023 02:57:24 +0200 Subject: [PATCH] Prevent cache generation crash due to unavailable Studio System When integrating this addon, the cache generation routine encounters an inability to access the studio system, resulting in a crash. This pull request implements safeguards to prevent such crashes. --- addons/FMOD/native/src/fmod_studio_editor_module.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/FMOD/native/src/fmod_studio_editor_module.cpp b/addons/FMOD/native/src/fmod_studio_editor_module.cpp index f59aec3..3ed2c63 100644 --- a/addons/FMOD/native/src/fmod_studio_editor_module.cpp +++ b/addons/FMOD/native/src/fmod_studio_editor_module.cpp @@ -623,6 +623,12 @@ Dictionary FMODStudioEditorModule::get_project_info_from_banks() String guid = bank_asset->get_guid(); FMOD_GUID fmod_guid{}; FMOD_Studio_ParseID(guid.utf8().get_data(), &fmod_guid); + + if (!studio_system) + { + break; + } + studio_system->getBankByID(&fmod_guid, &bank); if (!FileAccess::file_exists(resource_dirs["banks"].operator godot::String() + guid + ".tres")) @@ -766,7 +772,11 @@ Dictionary FMODStudioEditorModule::get_project_info_from_banks() } int parameter_count = 0; - studio_system->getParameterDescriptionCount(¶meter_count); + + if (studio_system) + { + studio_system->getParameterDescriptionCount(¶meter_count); + } if (parameter_count > 0) {