]> git.mxchange.org Git - flightgear.git/commitdiff
don't crash when a panel (or one of its elements) can't be found (-> pc7)
authormfranz <mfranz>
Sun, 3 Dec 2006 20:14:12 +0000 (20:14 +0000)
committermfranz <mfranz>
Sun, 3 Dec 2006 20:14:12 +0000 (20:14 +0000)
src/Model/panelnode.cxx

index 29b4d0e725a4a1d29222be9db25c3995c56ad925..c32d89830b2c6fe487d04ac72333f170649766fe 100644 (file)
@@ -3,6 +3,8 @@
 #endif
 
 #include <simgear/compiler.h>
+#include <simgear/structure/exception.hxx>
+
 #include <vector>
 
 #include <plib/sg.h>
@@ -41,7 +43,10 @@ FGPanelNode::FGPanelNode(SGPropertyNode* props)
 
     // Make an FGPanel object.  But *don't* call init() or bind() on
     // it -- those methods touch static state.
-    _panel = fgReadPanel(props->getStringValue("path"));
+    const char *path = props->getStringValue("path");
+    _panel = fgReadPanel(path);
+    if (!_panel)
+        throw sg_io_exception(string("Failed to load panel ") + path);
 
     // Never mind.  We *have* to call init to make sure the static
     // state is initialized (it's not, if there aren't any 2D