From f5cbd0056d601e4adaf5ed9006192dd510226ee3 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Fri, 25 Aug 2023 01:06:43 -0600 Subject: Fixed crash on linux --- src/storm/SWrapper.cpp | 8 ++++---- src/storm/SWrapper.h | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/storm/SWrapper.cpp b/src/storm/SWrapper.cpp index e841f4a..2e3b109 100644 --- a/src/storm/SWrapper.cpp +++ b/src/storm/SWrapper.cpp @@ -16,10 +16,6 @@ SWrapper::SWrapper(const std::string& path) { } } -SWrapper::~SWrapper() { - SFileCloseArchive(this->hMpq); -} - bool SWrapper::CreateFile(std::string path, std::vector data) { HANDLE hFile; #ifdef _WIN32 @@ -63,5 +59,9 @@ bool SWrapper::CreateFile(std::string path, std::vector data) { } void SWrapper::Close() { + if(this->hMpq == nullptr) { + std::cout << "Archive already closed" << std::endl; + return; + } SFileCloseArchive(this->hMpq); } \ No newline at end of file diff --git a/src/storm/SWrapper.h b/src/storm/SWrapper.h index 4801566..b7e50ec 100644 --- a/src/storm/SWrapper.h +++ b/src/storm/SWrapper.h @@ -7,7 +7,6 @@ class SWrapper { public: SWrapper(const std::string& path); - ~SWrapper(); std::vector ReadFile(std::string path); bool CreateFile(std::string path, std::vector data); -- cgit v1.2.3