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

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


SVN commit 999654 by mansona:

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


 M  +7 -2      GeoParser.cpp  


--- branches/KDE/4.3/kdeedu/marble/src/lib/geodata/parser/GeoParser.cpp #999653:999654
@@ -95,7 +95,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();
         }
@@ -124,7 +124,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