From bebec19544fa88ae8c3543b20bba998577861922 Mon Sep 17 00:00:00 2001 From: iobyte Date: Mon, 1 Jun 2020 01:34:28 +0000 Subject: [PATCH] fix crash loading hidden-valley.acc because of trailing white space on texture coordinates git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7120 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 13d9131f6b34b06a7c5b8b71712a8aa359ee3eb4 Former-commit-id: 526bf47a52ceb9fc8140e5c2eba1f2d1eecd9691 --- src/modules/graphic/osggraph/Loader/ReaderWriterACC.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/graphic/osggraph/Loader/ReaderWriterACC.cpp b/src/modules/graphic/osggraph/Loader/ReaderWriterACC.cpp index fcb63cf58..d5d39cee6 100644 --- a/src/modules/graphic/osggraph/Loader/ReaderWriterACC.cpp +++ b/src/modules/graphic/osggraph/Loader/ReaderWriterACC.cpp @@ -472,6 +472,11 @@ osg::Node* ReaderWriterACC::readObject(std::istream& stream, FileData& fileData, std::string strUVs; std::getline(stream,strUVs); + // trim any trailing white space + size_t endpos = strUVs.find_last_not_of(" \n\r\t"); + if (endpos != std::string::npos) + strUVs.resize(endpos + 1); + /*while(!strUVs.empty() && isspace(strUVs[strUVs.size()-1])) strUVs.pop_back();*/ /*osg::notify(osg::FATAL) << "osgDB SPEED DREAMS reader: string nRefs texture vertex \""