From 092bea979705ee76a362ffaf81bcb5743b50f4be Mon Sep 17 00:00:00 2001 From: SimoSbara <38192614+SimoSbara@users.noreply.github.com> Date: Thu, 23 Nov 2023 20:33:28 +0100 Subject: [PATCH] Bug fix crash in case of null path --- .gitignore | 3 ++- src/converter/ConverterGLTF.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 24fa204..0f40977 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ input/* output/* out/* build/* -bin/* \ No newline at end of file +bin/* +CMakeSettings.json diff --git a/src/converter/ConverterGLTF.cpp b/src/converter/ConverterGLTF.cpp index 50fd9c1..1918493 100644 --- a/src/converter/ConverterGLTF.cpp +++ b/src/converter/ConverterGLTF.cpp @@ -432,6 +432,9 @@ int ConverterGLTF::insertIndices(std::vector& buffer, rw::Split* split, in bool ConverterGLTF::convert(char* output, char* inputDff, char* inputTxd) { + if (!inputDff || !inputTxd || !output) + return false; + std::ifstream dff(inputDff, std::ios::binary); std::ifstream txd(inputTxd, std::ios::binary); @@ -453,6 +456,9 @@ bool ConverterGLTF::convert(char* output, rw::Clump& dff) bool ConverterGLTF::convert(char* output, rw::Clump& dff, rw::TextureDictionary& txd) { + if (!output) + return false; + if (dff.geometryList.size() <= 0) return false;