1
0
Fork 0

Fix a crash with GPS dialog.

If an invalid filter type is supplied, don't run the queries.
This showed up with GPS dialog, since the PUI combo box defaults to
no entry selected, not the first entry.
This commit is contained in:
James Turner 2013-10-02 22:08:17 +01:00
parent f5b352429c
commit b2759d018b

View file

@ -395,9 +395,13 @@ static naRef f_findWithinRange(nasal::CallContext ctx)
{
SGGeod pos = getPosition(ctx);
double range_nm = ctx.requireArg<double>(0);
FGPositioned::TypeFilter filter(FGPositioned::typeFromName(ctx.getArg<std::string>(1)));
FGPositioned::Type ty = FGPositioned::typeFromName(ctx.getArg<std::string>(1));
if (ty == FGPositioned::INVALID)
naRuntimeError(ctx.c, "invalid filter type specification");
FGPositioned::TypeFilter filter(ty);
FGPositionedList items = FGPositioned::findWithinRange(pos, range_nm, &filter);
FGPositioned::sortByRange(items, pos);
return ctx.to_nasal(items);