From 5d6b2de1f3c68268087f3402ba05b70e0d2a9ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 19 Oct 2022 08:27:40 +0200 Subject: [PATCH] Fix exporting big templates (cherry picked from commit 86fa3ba56015b0fb6f282277b37c211fe803c6f9) --- core/os/dir_access.cpp | 2 +- scene/property_utils.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index 30aef3834..e88cba51f 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -301,7 +301,7 @@ Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) { const size_t copy_buffer_limit = 65536; // 64 KB fsrc->seek_end(0); - int size = fsrc->get_position(); + uint64_t size = fsrc->get_position(); fsrc->seek(0); err = OK; size_t buffer_size = MIN(size * sizeof(uint8_t), copy_buffer_limit); diff --git a/scene/property_utils.cpp b/scene/property_utils.cpp index 023630ba7..5dbd97f29 100644 --- a/scene/property_utils.cpp +++ b/scene/property_utils.cpp @@ -167,8 +167,10 @@ static bool _collect_inheritance_chain(const Ref &p_state, const Nod state = state->get_base_scene_state(); } - for (int i = inheritance_states.size() - 1; i >= 0; --i) { - r_states_stack.push_back(inheritance_states[i]); + if (inheritance_states.size() > 0) { + for (int i = inheritance_states.size() - 1; i >= 0; --i) { + r_states_stack.push_back(inheritance_states[i]); + } } return found; @@ -212,10 +214,12 @@ Vector PropertyUtils::get_node_states_stack(const Node *p { states_stack_ret.resize(states_stack.size()); _FastPackState *ps = states_stack.ptr(); - for (int i = states_stack.size() - 1; i >= 0; --i) { - states_stack_ret.write[i].state.reference_ptr(ps->state); - states_stack_ret.write[i].node = ps->node; - ++ps; + if (states_stack.size() > 0) { + for (int i = states_stack.size() - 1; i >= 0; --i) { + states_stack_ret.write[i].state.reference_ptr(ps->state); + states_stack_ret.write[i].node = ps->node; + ++ps; + } } } return states_stack_ret;