[Lemon-commits] [lemon_svn] ladanyi: r2441 - hugo/trunk/gui

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:52:38 CET 2006


Author: ladanyi
Date: Mon Dec 19 17:59:05 2005
New Revision: 2441

Modified:
   hugo/trunk/gui/mapstorage.cc

Log:
Fix crash when the input file does not contain any nodeset or edgeset.

Modified: hugo/trunk/gui/mapstorage.cc
==============================================================================
--- hugo/trunk/gui/mapstorage.cc	(original)
+++ hugo/trunk/gui/mapstorage.cc	Mon Dec 19 17:59:05 2005
@@ -212,6 +212,22 @@
     ContentReader content(lreader);
     lreader.run();
 
+    if (content.nodeSetNum() < 1)
+    {
+      Gtk::MessageDialog mdialog("No nodeset found in file.");
+      mdialog.run();
+      clear();
+      return 1;
+    }
+
+    if (content.edgeSetNum() < 1)
+    {
+      Gtk::MessageDialog mdialog("No edgeset found in file.");
+      mdialog.run();
+      clear();
+      return 1;
+    }
+
     const std::vector<std::string>& nodeMapNames = content.nodeSetMaps(0);
     const std::vector<std::string>& edgeMapNames = content.edgeSetMaps(0);
 
@@ -256,7 +272,7 @@
     }
     GuiReader gui_reader(greader, this);
     greader.run();
-  } catch (DataFormatError& error) {
+  } catch (Exception& error) {
     Gtk::MessageDialog mdialog(error.what());
     mdialog.run();
     clear();



More information about the Lemon-commits mailing list