diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/io/file_access_pack.cpp | 16 | ||||
-rw-r--r-- | core/string_builder.cpp | 3 |
2 files changed, 17 insertions, 2 deletions
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 54ef753b7c..34d3eb5344 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -151,6 +151,7 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files) magic = f->get_32(); if (magic != 0x43504447) { + f->close(); memdelete(f); return false; } @@ -162,6 +163,7 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files) magic = f->get_32(); if (magic != 0x43504447) { + f->close(); memdelete(f); return false; } @@ -172,8 +174,16 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files) uint32_t ver_minor = f->get_32(); f->get_32(); // ver_rev - ERR_FAIL_COND_V_MSG(version != PACK_VERSION, false, "Pack version unsupported: " + itos(version) + "."); - ERR_FAIL_COND_V_MSG(ver_major > VERSION_MAJOR || (ver_major == VERSION_MAJOR && ver_minor > VERSION_MINOR), false, "Pack created with a newer version of the engine: " + itos(ver_major) + "." + itos(ver_minor) + "."); + if (version != PACK_VERSION) { + f->close(); + memdelete(f); + ERR_FAIL_V_MSG(false, "Pack version unsupported: " + itos(version) + "."); + } + if (ver_major > VERSION_MAJOR || (ver_major == VERSION_MAJOR && ver_minor > VERSION_MINOR)) { + f->close(); + memdelete(f); + ERR_FAIL_V_MSG(false, "Pack created with a newer version of the engine: " + itos(ver_major) + "." + itos(ver_minor) + "."); + } for (int i = 0; i < 16; i++) { //reserved @@ -200,6 +210,8 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files) PackedData::get_singleton()->add_path(p_path, path, ofs, size, md5, this, p_replace_files); }; + f->close(); + memdelete(f); return true; }; diff --git a/core/string_builder.cpp b/core/string_builder.cpp index 35526e0d70..22eed70f8b 100644 --- a/core/string_builder.cpp +++ b/core/string_builder.cpp @@ -34,6 +34,9 @@ StringBuilder &StringBuilder::append(const String &p_string) { + if (p_string == String()) + return *this; + strings.push_back(p_string); appended_strings.push_back(-1); |