Collada: improved Error handling: Avoid shutdown of Blender when the Collada importer finds Syntax errors in import data

This commit is contained in:
Gaia Clary 2017-06-24 21:50:04 +02:00
parent 0d2b1da3a6
commit 89060babbc
Notes: blender-bot 2023-02-14 09:02:41 +01:00
Referenced by issue #50996, Crash on import Collada file
1 changed files with 3 additions and 6 deletions

View File

@ -49,7 +49,7 @@ ErrorHandler::~ErrorHandler()
//--------------------------------------------------------------------
bool ErrorHandler::handleError(const COLLADASaxFWL::IError *error)
{
bool isError = true;
bool isError = false;
if (error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER) {
COLLADASaxFWL::SaxParserError *saxParserError = (COLLADASaxFWL::SaxParserError *) error;
@ -81,10 +81,7 @@ bool ErrorHandler::handleError(const COLLADASaxFWL::IError *error)
* Accept non critical errors as warnings (i.e. texture not found)
* This makes the importer more graceful, so it now imports what makes sense.
*/
if (saxFWLError->getSeverity() == COLLADASaxFWL::IError::SEVERITY_ERROR_NONCRITICAL) {
isError = false;
}
isError = (saxFWLError->getSeverity() != COLLADASaxFWL::IError::SEVERITY_ERROR_NONCRITICAL);
std::cout << "Sax FWL Error: " << saxFWLError->getErrorMessage() << std::endl;
}
else {
@ -93,5 +90,5 @@ bool ErrorHandler::handleError(const COLLADASaxFWL::IError *error)
mError |= isError;
return false; // let OpenCollada decide when to abort
return isError; // let OpenCollada decide when to abort
}