Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
Prevent cache generation crash due to unavailable Studio System
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alessandrofama committed Aug 19, 2023
1 parent 904d7d9 commit b31d95e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion addons/FMOD/native/src/fmod_studio_editor_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -766,7 +772,11 @@ Dictionary FMODStudioEditorModule::get_project_info_from_banks()
}

int parameter_count = 0;
studio_system->getParameterDescriptionCount(&parameter_count);

if (studio_system)
{
studio_system->getParameterDescriptionCount(&parameter_count);
}

if (parameter_count > 0)
{
Expand Down

0 comments on commit b31d95e

Please sign in to comment.