# HG changeset patch # User ladanyi # Date 1135011545 0 # Node ID 7234b7fabd051a0e7a434c8c3043286652e98f1c # Parent ad84ee331106910b2e1ef4bd3ab6e4e1e488af8e Fix crash when the input file does not contain any nodeset or edgeset. diff -r ad84ee331106 -r 7234b7fabd05 mapstorage.cc --- a/mapstorage.cc Sun Dec 18 01:51:03 2005 +0000 +++ b/mapstorage.cc Mon Dec 19 16:59:05 2005 +0000 @@ -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& nodeMapNames = content.nodeSetMaps(0); const std::vector& 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();