From 30d342534a1ea5d71f87dd5f1f255f9d6146c86e Mon Sep 17 00:00:00 2001 From: Adrian Perez Date: Fri, 16 Jul 2021 14:21:32 -0700 Subject: [PATCH] Fix issues encountered during integration atempt --- code/AssetLib/glTF/glTFCommon.h | 6 +++--- code/AssetLib/glTF2/glTF2Asset.inl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/AssetLib/glTF/glTFCommon.h b/code/AssetLib/glTF/glTFCommon.h index d99ffbe86..0506ad056 100644 --- a/code/AssetLib/glTF/glTFCommon.h +++ b/code/AssetLib/glTF/glTFCommon.h @@ -195,11 +195,11 @@ inline void CopyValue(const glTFCommon::mat4 &v, aiMatrix4x4 &o) { inline std::string getCurrentAssetDir(const std::string &pFile) { std::string path = pFile; int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\'))); - if (pos != int(std::string::npos)) { - path = pFile.substr(0, pos + 1); + if (pos == int(std::string::npos)) { + return ""; } - return path; + return pFile.substr(0, pos + 1); } #if _MSC_VER # pragma warning(pop) diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index fd509bada..58095c7bd 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -965,9 +965,9 @@ inline void Accessor::Read(Value &obj, Asset &r) { componentType = MemberOrDefault(obj, "componentType", ComponentType_BYTE); { const Value* countValue = FindUInt(obj, "count"); - if (!countValue || countValue->GetUint() < 1) + if (!countValue) { - throw DeadlyImportError("A strictly positive count value is required, when reading ", id.c_str(), name.empty() ? "" : " (" + name + ")"); + throw DeadlyImportError("A count value is required, when reading ", id.c_str(), name.empty() ? "" : " (" + name + ")"); } count = countValue->GetUint(); }