From c55e334eadb879c04b43d3220859f65c00a1208f Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Fri, 10 Nov 2023 14:58:07 +0800 Subject: [PATCH] fix texture saving error --- LibCmo/CK2/DataHandlers/CKBitmapHandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LibCmo/CK2/DataHandlers/CKBitmapHandler.cpp b/LibCmo/CK2/DataHandlers/CKBitmapHandler.cpp index 102c3fa..a001411 100644 --- a/LibCmo/CK2/DataHandlers/CKBitmapHandler.cpp +++ b/LibCmo/CK2/DataHandlers/CKBitmapHandler.cpp @@ -192,7 +192,8 @@ namespace LibCmo::CK2::DataHandlers { delete[] data; std::fclose(fs); - return ret == 0; + // ret is 0 mean failed. + return ret != 0; } static CKDWORD StbSaveMemory(void* memory, const VxMath::VxImageDescEx* write_image, SaveOperation oper) { if (write_image == nullptr) return 0; @@ -215,6 +216,7 @@ namespace LibCmo::CK2::DataHandlers { delete ctx; delete[] data; + // ret is 0 mean failed. return zero size. if (ret == 0) return 0; else return expected; }