Code shuffle so function has only one exit point.
authorNathan Letwory <nathan@letworyinteractive.com>
Mon, 12 Sep 2011 10:57:41 +0000 (10:57 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Mon, 12 Sep 2011 10:57:41 +0000 (10:57 +0000)
source/blender/collada/ErrorHandler.cpp

index 7108dbad18ad27e31245a150690bd5012fd53114..61c03ed673c665f99297766fe528d4bb33ba2926 100644 (file)
@@ -49,6 +49,8 @@ ErrorHandler::~ErrorHandler()
 //--------------------------------------------------------------------
 bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
 {
+       mError = true;
+       
        if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER )
        {
                COLLADASaxFWL::SaxParserError* saxParserError = (COLLADASaxFWL::SaxParserError*) error;
@@ -59,32 +61,29 @@ bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
                {
                        if ( strcmp(parserError.getElement(), "effect") == 0 )
                        {
-                               return false;
+                               mError = false;
                        }
                }
                if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT)
                {
-                       if ( (strcmp(parserError.getElement(), "extra") == 0) 
-                               && (strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0)) 
+                       if ( !((strcmp(parserError.getElement(), "extra") == 0) 
+                               && (strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0)))
                        {
-                               return false;
+                               mError = false;
                        }
                }
 
                if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_COULD_NOT_OPEN_FILE)
                {
                        std::cout << "Couldn't open file" << std::endl;
-                       mError = true;
                }
 
                std::cout << "Schema validation error: " << parserError.getErrorMessage() << std::endl;
-               mError = true;
        }
        else if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXFWL )
        {
                COLLADASaxFWL::SaxFWLError* saxFWLError = (COLLADASaxFWL::SaxFWLError*) error;
                std::cout << "Sax FWL Error: " << saxFWLError->getErrorMessage() << std::endl;
-               mError = true;
        }
        return false;
 }