diff --git a/simgear/environment/metar.cxx b/simgear/environment/metar.cxx index 91846d5f..08e72bfb 100644 --- a/simgear/environment/metar.cxx +++ b/simgear/environment/metar.cxx @@ -631,11 +631,15 @@ bool SGMetar::scanWind() int dir; if (!strncmp(m, "VRB", 3)) m += 3, dir = -1; + else if (!strncmp(m, "///", 3)) // direction not measurable + m += 3, dir = -1; else if (!scanNumber(&m, &dir, 3)) return false; int i; - if (!scanNumber(&m, &i, 2, 3)) + if (!strncmp(m, "//", 2)) // speed not measurable + m += 2, i = -1; + else if (!scanNumber(&m, &i, 2, 3)) return false; double speed = i; diff --git a/simgear/environment/test_metar.cxx b/simgear/environment/test_metar.cxx index f97a3d18..bf5d2cbe 100644 --- a/simgear/environment/test_metar.cxx +++ b/simgear/environment/test_metar.cxx @@ -76,12 +76,20 @@ void test_sensor_failure_cloud() SG_CHECK_EQUAL_EP2(m1.getPressure_hPa(), 1025, TEST_EPSILON); } +void test_sensor_failure_wind() +{ + SGMetar m1("2020/10/23 16:55 LIVD 231655Z /////KT 9999 OVC025 10/08 Q1020 RMK OVC VIS MIN 9999 BLU"); + SG_CHECK_EQUAL(m1.getWindDir(), -1); + SG_CHECK_EQUAL_EP2(m1.getWindSpeed_kt(), -1, TEST_EPSILON); +} + int main(int argc, char* argv[]) { try { test_basic(); test_sensor_failure_weather(); test_sensor_failure_cloud(); + test_sensor_failure_wind(); } catch (sg_exception& e) { cerr << "got exception:" << e.getMessage() << endl; return -1;