diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-13 15:52:23 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-13 15:52:23 +0100 |
commit | d62aef71f655b955f5596b9fe53065ff590fd45f (patch) | |
tree | 80bba2c0b838327dccbea8a76f2bff8b15cafe67 /modules | |
parent | 2abfa9eafe42deed19a0e339d8c3b52249849c5f (diff) | |
parent | ab2373675109104d812499f9bd0f56ce7f2e93c9 (diff) |
Merge pull request #68603 from HolonProduction/zip
Fix problem with ZIPPacker
Diffstat (limited to 'modules')
-rw-r--r-- | modules/zip/zip_packer.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/zip/zip_packer.cpp b/modules/zip/zip_packer.cpp index e62700f191..5566848087 100644 --- a/modules/zip/zip_packer.cpp +++ b/modules/zip/zip_packer.cpp @@ -46,7 +46,11 @@ Error ZIPPacker::open(String p_path, ZipAppend p_append) { Error ZIPPacker::close() { ERR_FAIL_COND_V_MSG(fa.is_null(), FAILED, "ZIPPacker cannot be closed because it is not open."); - return zipClose(zf, NULL) == ZIP_OK ? OK : FAILED; + Error err = zipClose(zf, NULL) == ZIP_OK ? OK : FAILED; + if (err == OK) { + zf = NULL; + } + return err; } Error ZIPPacker::start_file(String p_path) { @@ -79,11 +83,7 @@ Error ZIPPacker::write_file(Vector<uint8_t> p_data) { Error ZIPPacker::close_file() { ERR_FAIL_COND_V_MSG(fa.is_null(), FAILED, "ZIPPacker must be opened before use."); - Error err = zipCloseFileInZip(zf) == ZIP_OK ? OK : FAILED; - if (err == OK) { - zf = NULL; - } - return err; + return zipCloseFileInZip(zf) == ZIP_OK ? OK : FAILED; } void ZIPPacker::_bind_methods() { |