[Marble-commits] KDE/kdeedu/marble/src/lib/geodata/parser

Andrew Manson g.real.ate at gmail.com
Mon Jul 20 12:27:32 CEST 2009


SVN commit 999651 by mansona:

Bug:181976 fixed
Deals with bad XML files by producing a warning instead of a crash. 


 M  +7 -2      GeoParser.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoParser.cpp #999650:999651
@@ -96,7 +96,7 @@
                 if ( !m_nodeStack.isEmpty() )
                     raiseError(
                         QObject::tr("Parsing failed. Still %n unclosed tag(s) after document end.", "",
-                        m_nodeStack.size() ));
+                        m_nodeStack.size() ) + errorString());
             } else
                 raiseDocumentElementError();
         }
@@ -125,7 +125,12 @@
 
 void GeoParser::parseDocument()
 {
-    Q_ASSERT( isStartElement() );
+    if( !isStartElement() ) {
+        raiseError( QString("Error parsing file at line: %1 and column %2 . ")
+                    .arg( lineNumber() ).arg( columnNumber() )
+                    +  QString("This is an Invalid File") );
+        return;
+    }
 
     while ( !atEnd() ) {
         readNext();


More information about the Marble-commits mailing list