]> git.mxchange.org Git - flightgear.git/commitdiff
We never want to know if a dialog is there or not. If we ask for one and
authormfranz <mfranz>
Sat, 22 Oct 2005 16:51:27 +0000 (16:51 +0000)
committermfranz <mfranz>
Sat, 22 Oct 2005 16:51:27 +0000 (16:51 +0000)
it isn't there, this is a bug. Thus centralize the error message so that it
doesn't have to be repeated everywhere. Of course, the calling code should
still consider that a returned property node may be 0.

src/GUI/gui_funcs.cxx
src/GUI/new_gui.cxx

index 8ee2d9b443f7db287d11c0431fada9129d5508a6..bc6bdc9c843cbbd17ae8fdc1936ad315f368a8a9 100644 (file)
@@ -166,10 +166,8 @@ void mkDialog (const char *txt)
 {
     NewGUI *gui = (NewGUI *)globals->get_subsystem("gui");
     SGPropertyNode_ptr dlg = gui->getDialog("message");
-    if (!dlg) {
-        SG_LOG(SG_GENERAL, SG_ALERT, "'message' dialog missing");
+    if (!dlg)
         return;
-    }
 
     dlg->setStringValue("text/label", txt);
     dlg->setStringValue("button/legend", "OK");
index a0885b845caad84022e1c7b4f96a098f62615c34..f45b17ba761e5c3ec3a2618336ba6b4b26ed119c 100644 (file)
@@ -147,8 +147,9 @@ NewGUI::getDialog (const string &name)
 {
     if(_dialog_props.find(name) != _dialog_props.end())
         return _dialog_props[name];
-    else
-        return 0;
+
+    SG_LOG(SG_GENERAL, SG_ALERT, "dialog '" << name << "' missing");
+    return 0;
 }
 
 void