1
0
Fork 0

Bugfix: guard against corrupted airport XML.

This commit is contained in:
James Turner 2014-01-14 13:42:11 +00:00
parent 1b9394fc37
commit d8a3f160ef

View file

@ -570,12 +570,16 @@ void FGAirport::loadSceneryDefinitions() const
return; return;
} }
flightgear::NavDataCache::Transaction txn(cache); try {
SGPropertyNode_ptr rootNode = new SGPropertyNode; flightgear::NavDataCache::Transaction txn(cache);
readProperties(path.str(), rootNode); SGPropertyNode_ptr rootNode = new SGPropertyNode;
const_cast<FGAirport*>(this)->readThresholdData(rootNode); readProperties(path.str(), rootNode);
cache->stampCacheFile(path); const_cast<FGAirport*>(this)->readThresholdData(rootNode);
txn.commit(); cache->stampCacheFile(path);
txn.commit();
} catch (sg_exception& e) {
SG_LOG(SG_NAVAID, SG_WARN, ident() << "loading threshold XML failed:" << e.getFormattedMessage());
}
} }
void FGAirport::readThresholdData(SGPropertyNode* aRoot) void FGAirport::readThresholdData(SGPropertyNode* aRoot)
@ -653,13 +657,17 @@ void FGAirport::validateTowerData() const
// cached values are correct, we're all done // cached values are correct, we're all done
return; return;
} }
flightgear::NavDataCache::Transaction txn(cache); try {
SGPropertyNode_ptr rootNode = new SGPropertyNode; flightgear::NavDataCache::Transaction txn(cache);
readProperties(path.str(), rootNode); SGPropertyNode_ptr rootNode = new SGPropertyNode;
const_cast<FGAirport*>(this)->readTowerData(rootNode); readProperties(path.str(), rootNode);
cache->stampCacheFile(path); const_cast<FGAirport*>(this)->readTowerData(rootNode);
txn.commit(); cache->stampCacheFile(path);
txn.commit();
} catch (sg_exception& e){
SG_LOG(SG_NAVAID, SG_WARN, ident() << "loading twr XML failed:" << e.getFormattedMessage());
}
} }
void FGAirport::readTowerData(SGPropertyNode* aRoot) void FGAirport::readTowerData(SGPropertyNode* aRoot)
@ -706,16 +714,21 @@ bool FGAirport::validateILSData()
return false; return false;
} }
SGPropertyNode_ptr rootNode = new SGPropertyNode; try {
readProperties(path.str(), rootNode); SGPropertyNode_ptr rootNode = new SGPropertyNode;
readProperties(path.str(), rootNode);
flightgear::NavDataCache::Transaction txn(cache); flightgear::NavDataCache::Transaction txn(cache);
readILSData(rootNode); readILSData(rootNode);
cache->stampCacheFile(path); cache->stampCacheFile(path);
txn.commit(); txn.commit();
// we loaded data, tell the caller it might need to reload things // we loaded data, tell the caller it might need to reload things
return true; return true;
} catch (sg_exception& e){
SG_LOG(SG_NAVAID, SG_WARN, ident() << "loading ils XML failed:" << e.getFormattedMessage());
}
return false;
} }
void FGAirport::readILSData(SGPropertyNode* aRoot) void FGAirport::readILSData(SGPropertyNode* aRoot)