From 880e4908ac91f67ba954dedd9f3799067a977e0b Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 3 Dec 2006 20:14:12 +0000 Subject: [PATCH] don't crash when a panel (or one of its elements) can't be found (-> pc7) --- src/Model/panelnode.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Model/panelnode.cxx b/src/Model/panelnode.cxx index 29b4d0e72..c32d89830 100644 --- a/src/Model/panelnode.cxx +++ b/src/Model/panelnode.cxx @@ -3,6 +3,8 @@ #endif #include +#include + #include #include @@ -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 -- 2.39.5