From c3210df4487c3d3fc9677582e9a383da21770ecd Mon Sep 17 00:00:00 2001 From: dzil123 <5725958+dzil123@users.noreply.github.com> Date: Wed, 16 Nov 2022 06:52:47 -0800 Subject: [PATCH] [3.x] PCKPacker Fix error spam (cherry picked from commit b3812750da557835eb8e79b9cca6a1e54f9a4531) --- core/io/pck_packer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 68e2f1050bf..68dc2af2316 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -86,6 +86,8 @@ Error PCKPacker::pck_start(const String &p_file, int p_alignment) { }; Error PCKPacker::add_file(const String &p_file, const String &p_src) { + ERR_FAIL_COND_V_MSG(!file, ERR_INVALID_PARAMETER, "File must be opened before use."); + FileAccess *f = FileAccess::open(p_src, FileAccess::READ); if (!f) { return ERR_FILE_CANT_OPEN; @@ -165,6 +167,9 @@ Error PCKPacker::flush(bool p_verbose) { } file->close(); + memdelete(file); + file = nullptr; + memdelete_arr(buf); return OK;