[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/marble
From:       Torsten Rahn <tackat () kde ! org>
Date:       2008-01-01 10:57:37
Message-ID: 1199185057.316636.24738.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 755375 by rahn:

    * src/lib/MarbleModel.cpp: more paranoid check whether the 
      .dgml file has been opened successfully.



 M  +5 -0      ChangeLog  
 M  +15 -2     src/lib/MarbleModel.cpp  


--- trunk/KDE/kdeedu/marble/ChangeLog #755374:755375
@@ -1,3 +1,8 @@
+2008-01-01  Torsten Rahn  <rahn@kde.org>
+
+    * src/lib/MarbleModel.cpp: more paranoid check whether the 
+      .dgml file has been opened successfully.
+
 2007-12-31  Torsten Rahn  <rahn@kde.org>
 
     * src/lib/PlaceMarkLayout.{cpp,h}:
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #755374:755375
@@ -42,6 +42,7 @@
     // View and paint stuff
     MapTheme            *m_maptheme;
     QString              m_selectedMap;
+    int                  m_previousMapLoadedFine;
     TextureColorizer    *m_texcolorizer;
 
     HttpDownloadManager *m_downloadManager;
@@ -88,8 +89,8 @@
     d->m_placeMarkLayout   = 0;
 
     d->m_maptheme = new MapTheme();
+    d->m_previousMapLoadedFine = false;
 
-
     QStringList  mapthemedirs = MapTheme::findMapThemes( "maps/earth/" );
     QString      selectedmap;
 
@@ -202,8 +203,20 @@
     QString mapPath = QString("maps/earth/%1").arg( selectedMap );
     qDebug( "Setting map theme to : %s",
 	    qPrintable( MarbleDirs::path( mapPath ) ) );
-    d->m_maptheme->open( MarbleDirs::path( mapPath ) );
 
+    int error = d->m_maptheme->open( MarbleDirs::path( mapPath ) );
+    if ( error < 0 ){
+        if ( d->m_previousMapLoadedFine == true ) return;
+        else { 
+            // Actually this case can't really happen as the
+            // existance of valid .dgml files gets checked before and
+            // the directory string can't get invalid either.
+            qDebug() << "Couldn't find a valid map.";
+            exit(-1);
+        } 
+    }
+    d->m_previousMapLoadedFine = true;
+
     // If this layer is a bitmaplayer, check if the cached tiles for
     // it are already generated, and if not, do so.
     if ( d->m_maptheme->bitmaplayer().enabled ) {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic