Skip to content

Commit

Permalink
CraterCrashGH-143 Return null rather than 0-sized property info list
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Mar 8, 2024
1 parent 290f57e commit 300caeb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/script/instances/script_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ GDExtensionPropertyInfo* OScriptInstance::get_property_list(uint32_t* r_count)
}

*r_count = infos.size();
if (infos.size() == 0)
return nullptr;

GDExtensionPropertyInfo* list = MemoryUtils::memnew_with_size<GDExtensionPropertyInfo>(infos.size());
memcpy(list, infos.ptr(), sizeof(GDExtensionPropertyInfo) * infos.size());
return list;
Expand Down
3 changes: 3 additions & 0 deletions src/script/instances/script_instance_placeholder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ GDExtensionPropertyInfo* OScriptPlaceHolderInstance::get_property_list(uint32_t*

*r_count = infos.size();

if (infos.size() == 0)
return nullptr;

GDExtensionPropertyInfo* list = MemoryUtils::memnew_with_size<GDExtensionPropertyInfo>(infos.size());
memcpy(list, infos.ptr(), sizeof(GDExtensionPropertyInfo) * infos.size());

Expand Down

0 comments on commit 300caeb

Please sign in to comment.