- SGPropertyNode instrument_group("/instruments", &props);
- int nInstruments = instrument_group.size();
- for (int i = 0; i < nInstruments; i++) {
- SGPropertyList props2;
- SGPropertyNode node = instrument_group.getChild(i);
-
- FGPath path(current_options.get_fg_root());
- path.append(node.getStringValue("path"));
-
- FG_LOG(FG_INPUT, FG_INFO, "Reading instrument "
- << node.getName()
- << " from "
- << path.str());
-
- int x = node.getIntValue("x", -1);
- int y = node.getIntValue("y", -1);
- int w = node.getIntValue("w", -1);
- int h = node.getIntValue("h", -1);
-
- if (x == -1 || y == -1) {
- FG_LOG(FG_INPUT, FG_ALERT, "x and y positions must be specified and >0");
- delete panel;
- return 0;
- }
-
-
- FGPanelInstrument * instrument = 0;
+ const SGPropertyNode * instrument_group = root.getChild("instruments");
+ if (instrument_group != 0) {
+ int nInstruments = instrument_group->nChildren();
+ for (int i = 0; i < nInstruments; i++) {
+ const SGPropertyNode * node = instrument_group->getChild(i);
+
+ FGPath path( globals->get_fg_root() );
+ path.append(node->getStringValue("path"));
+
+ FG_LOG(FG_INPUT, FG_INFO, "Reading instrument "
+ << node->getName()
+ << " from "
+ << path.str());
+
+ int x = node->getIntValue("x", -1);
+ int y = node->getIntValue("y", -1);
+ int w = node->getIntValue("w", -1);
+ int h = node->getIntValue("h", -1);
+
+ if (x == -1 || y == -1) {
+ FG_LOG(FG_INPUT, FG_ALERT, "x and y positions must be specified and >0");
+ delete panel;
+ return 0;
+ }