#include <stdlib.h>
#include <algorithm>
+#include <simgear/structure/exception.hxx>
+
#include <Main/fg_props.hxx>
#include "environment_mgr.hxx"
void
FGMetarEnvironmentCtrl::reinit ()
{
+#if 0
if (_icao != NULL) {
free(_icao);
_icao = NULL;
fgGetDouble("/environment/metar/temperature-degc"));
fgSetDouble("/environment/dewpoint-degc",
fgGetDouble("/environment/metar/dewpoint-degc"));
+#endif
env->reinit();
}
_icao = strdup(icao);
}
- SGMetar *m = new SGMetar(_icao);
+
+ SGMetar *m;
+ try {
+ m = new SGMetar(_icao);
+ } catch (const sg_io_exception& e) {
+ SG_LOG( SG_GENERAL, SG_WARN, "Error fetching live weather data: "
+ << e.getFormattedMessage().c_str() );
+ return;
+ }
d = m->getMinVisibility().getVisibility_m();
d = (d != SGMetarNaN) ? d : 10000;