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