From 044e65eb20d592ac072bb8bd9bb3f80f3e06486f Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 5 Oct 2021 18:47:10 +0200 Subject: [PATCH] sys: Fixed non-existing files being created in Read mode --- plugins/libimhex/source/helpers/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/libimhex/source/helpers/file.cpp b/plugins/libimhex/source/helpers/file.cpp index cbfce32da..0a533827e 100644 --- a/plugins/libimhex/source/helpers/file.cpp +++ b/plugins/libimhex/source/helpers/file.cpp @@ -9,7 +9,7 @@ namespace hex { else if (mode == File::Mode::Write) this->m_file = fopen64(path.c_str(), "r+b"); - if (mode == File::Mode::Create || this->m_file == nullptr) + if (mode == File::Mode::Create || (mode == File::Mode::Write && this->m_file == nullptr)) this->m_file = fopen64(path.c_str(), "w+b"); }