]> granicus.if.org Git - graphviz/commitdiff
Fix gvedit so that we don't try to lay out graphs with parse errors
authorerg <devnull@localhost>
Thu, 3 Mar 2011 00:52:59 +0000 (00:52 +0000)
committererg <devnull@localhost>
Thu, 3 Mar 2011 00:52:59 +0000 (00:52 +0000)
cmd/gvedit/csettings.cpp

index 13c6b16599c4c3421604bb39cf4317aa28e23a96..7556fa74c5aa93c15f95b4977a7088e32d1f2a5c 100644 (file)
@@ -269,6 +269,11 @@ bool CFrmSettings::createLayout()
     /* graph=agread_usergets(reinterpret_cast<FILE*>(this),(gets_f)graph_reader); */
     if(!graph)
        return false;
+    if (agerrors()) {
+       agclose (graph);
+       graph = NULL;
+       return false;
+    }
     Agraph_t* G=this->graph;
     gvLayout (gvc, G, (char*)WIDGET(QComboBox,cbLayout)->currentText().toUtf8().constData()); /* library function */
     return true;
@@ -327,12 +332,15 @@ void CFrmSettings::saveContent()
 }
 int CFrmSettings::drawGraph()
 {
-           createLayout();
-           renderLayout();
-           getActiveWindow()->settingsSet=false;
-           return QDialog::Accepted;
-
+    if (createLayout() && renderLayout()) {
+       getActiveWindow()->settingsSet=false;
+       return QDialog::Accepted;
+    }
+    else
+       return QDialog::Accepted;
+       /* return QDialog::Rejected; */
 }
+
 int CFrmSettings::runSettings(MdiChild* m)
 {
     if ((m) && (m==getActiveWindow()))