summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/pck_packer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index 8bc73103e9..fb83f0ac90 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -63,6 +63,10 @@ void PCKPacker::_bind_methods() {
Error PCKPacker::pck_start(const String &p_file, int p_alignment) {
+ if (file != NULL) {
+ memdelete(file);
+ }
+
file = FileAccess::open(p_file, FileAccess::WRITE);
ERR_FAIL_COND_V_MSG(!file, ERR_CANT_CREATE, "Can't open file to write: " + String(p_file) + ".");