From 8cdf9467c561061a11529ba8e247cba86d53f15f Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 1 Apr 2015 16:09:59 +0300 Subject: [PATCH] MD3: Fix assertion failures when filename doesn't contain '.' --- code/MD3Loader.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/MD3Loader.cpp b/code/MD3Loader.cpp index 49cecd1bf..dd5615e7a 100644 --- a/code/MD3Loader.cpp +++ b/code/MD3Loader.cpp @@ -471,6 +471,9 @@ void MD3Importer::ReadSkin(Q3Shader::SkinData& fill) const std::string::size_type s = filename.find_last_of('_'); if (s == std::string::npos) { s = filename.find_last_of('.'); + if (s == std::string::npos) { + s = filename.size(); + } } ai_assert(s != std::string::npos); @@ -532,7 +535,9 @@ bool MD3Importer::ReadMultipartFile() { // check whether the file name contains a common postfix, e.g lower_2.md3 std::string::size_type s = filename.find_last_of('_'), t = filename.find_last_of('.'); - ai_assert(t != std::string::npos); + + if (t == std::string::npos) + t = filename.size(); if (s == std::string::npos) s = t;