summaryrefslogtreecommitdiff
path: root/modules/zip/zip_packer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/zip/zip_packer.cpp')
-rw-r--r--modules/zip/zip_packer.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/zip/zip_packer.cpp b/modules/zip/zip_packer.cpp
index c37fc0945e..5566848087 100644
--- a/modules/zip/zip_packer.cpp
+++ b/modules/zip/zip_packer.cpp
@@ -46,11 +46,14 @@ 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) {
- ERR_FAIL_COND_V_MSG(zf != NULL, FAILED, "ZIPPacker is already in use.");
ERR_FAIL_COND_V_MSG(fa.is_null(), FAILED, "ZIPPacker must be opened before use.");
zip_fileinfo zipfi;
@@ -80,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() {