MD3: Fix assertion failures when filename doesn't contain '.'

pull/523/head
Turo Lamminen 2015-04-01 16:09:59 +03:00
parent 9f9774403d
commit 8cdf9467c5
1 changed files with 6 additions and 1 deletions

View File

@ -471,6 +471,9 @@ void MD3Importer::ReadSkin(Q3Shader::SkinData& fill) const
std::string::size_type s = filename.find_last_of('_'); std::string::size_type s = filename.find_last_of('_');
if (s == std::string::npos) { if (s == std::string::npos) {
s = filename.find_last_of('.'); s = filename.find_last_of('.');
if (s == std::string::npos) {
s = filename.size();
}
} }
ai_assert(s != std::string::npos); 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 // 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('.'); 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) if (s == std::string::npos)
s = t; s = t;