]> git.mxchange.org Git - flightgear.git/commitdiff
Patch from Erik Hofman:
authordavid <david>
Tue, 31 Dec 2002 00:56:14 +0000 (00:56 +0000)
committerdavid <david>
Tue, 31 Dec 2002 00:56:14 +0000 (00:56 +0000)
This patch turns out to be much more reliable compared to the previous
one I sent Curtis. Could you apply it for me?

src/Systems/electrical.cxx

index 9fc8109577f7f4f9ddac95281fe491814655b2b4..03ed8c9ffafe2d02ec9e7714fc14a96d3d642a92 100644 (file)
@@ -211,31 +211,36 @@ FGElectricalSystem::~FGElectricalSystem () {
 void FGElectricalSystem::init () {
     config_props = new SGPropertyNode;
 
-    SGPropertyNode *path_n = fgGetNode("/sim/systems/electrical/path", true);
+    SGPropertyNode *path_n = fgGetNode("/sim/systems/electrical/path");
 
-    SGPath config( globals->get_fg_root() );
-    config.append( path_n->getStringValue() );
+    if (path_n) {
+        SGPath config( globals->get_fg_root() );
+        config.append( path_n->getStringValue() );
 
-    SG_LOG( SG_ALL, SG_ALERT, "Reading electrical system model from "
-            << config.str() );
-    try {
-        readProperties( config.str(), config_props );
-
-        if ( build() ) {
-            enabled = true;
-        } else {
-            SG_LOG( SG_ALL, SG_ALERT,
-                    "Detected an internal inconsistancy in the electrical" );
-            SG_LOG( SG_ALL, SG_ALERT,
-                    " system specification file.  See earlier errors for" );
-            SG_LOG( SG_ALL, SG_ALERT,
-                    " details.");
-            exit(-1);
-        }        
-    } catch (const sg_exception& exc) {
-        SG_LOG( SG_ALL, SG_ALERT, "Failed to load electrical system model: "
+        SG_LOG( SG_ALL, SG_ALERT, "Reading electrical system model from "
                 << config.str() );
-    }
+        try {
+            readProperties( config.str(), config_props );
+
+            if ( build() ) {
+                enabled = true;
+            } else {
+                SG_LOG( SG_ALL, SG_ALERT,
+                        "Detected an internal inconsistancy in the electrical");
+                SG_LOG( SG_ALL, SG_ALERT,
+                        " system specification file.  See earlier errors for" );
+                SG_LOG( SG_ALL, SG_ALERT,
+                        " details.");
+                exit(-1);
+            }        
+        } catch (const sg_exception& exc) {
+            SG_LOG( SG_ALL, SG_ALERT, "Failed to load electrical system model: "
+                    << config.str() );
+        }
+
+    } else
+        SG_LOG( SG_ALL, SG_ALERT,
+                "No electrical model specified for this model!");
 
     delete config_props;
 }