Make Nasal airportinfo() tolerant of invalid airport idents.
This commit is contained in:
parent
ecfe4eb21b
commit
9cdcd76c6b
1 changed files with 3 additions and 1 deletions
|
@ -555,7 +555,9 @@ static naRef f_airportinfo(naContext c, naRef me, int argc, naRef* args)
|
||||||
// user provided an <id>, hopefully
|
// user provided an <id>, hopefully
|
||||||
apt = FGAirport::findByIdent(s);
|
apt = FGAirport::findByIdent(s);
|
||||||
if (!apt) {
|
if (!apt) {
|
||||||
naRuntimeError(c, "airportinfo() couldn't find airport: %s", s);
|
// return nil here, but don't raise a runtime error; this is a
|
||||||
|
// legitamate way to validate an ICAO code, for example in a
|
||||||
|
// dialog box or similar.
|
||||||
return naNil();
|
return naNil();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue