Fix issue where a sky condition without an altitude broke the interpreter
This commit is contained in:
parent
4e31390079
commit
6116c1d9b7
5
taf.go
5
taf.go
@ -107,10 +107,13 @@ func ParseWithOptions(r io.Reader, opts Options) (*Forecast, error) {
|
||||
Precipitation: Precipitation(item.Vicinity.Precipitation),
|
||||
})
|
||||
case item.SkyCondition != nil:
|
||||
altitude, err := strconv.Atoi(item.SkyCondition.Altitude)
|
||||
var altitude int
|
||||
if item.SkyCondition.Altitude != "" {
|
||||
altitude, err = strconv.Atoi(item.SkyCondition.Altitude)
|
||||
if err != nil {
|
||||
return nil, participle.Errorf(item.SkyCondition.Pos, "sky: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
appendField(out, "SkyCondition", SkyCondition{
|
||||
Altitude: altitude * 100, // Scale factor for altitude is 100
|
||||
|
Loading…
Reference in New Issue
Block a user