diff --git a/src/openrct2/core/Zip.cpp b/src/openrct2/core/Zip.cpp index 04d8a74106..9ecae3aa20 100644 --- a/src/openrct2/core/Zip.cpp +++ b/src/openrct2/core/Zip.cpp @@ -169,13 +169,19 @@ public: auto source = zip_source_buffer(_zip, writeBuffer.data(), writeBuffer.size(), 0); auto index = GetIndexFromPath(path); + zip_int64_t res = 0; if (index.has_value()) { - zip_replace(_zip, index.value(), source); + res = zip_file_replace(_zip, index.value(), source, 0); } else { - zip_add(_zip, path.data(), source); + res = zip_file_add(_zip, path.data(), source, 0); + } + if (res == -1) + { + zip_source_free(source); + throw std::runtime_error("Unable to set file contents."); } }