]> git.mxchange.org Git - flightgear.git/commitdiff
Validate arg to Nasal airport.comms().
authorJames Turner <zakalawe@mac.com>
Fri, 18 Oct 2013 14:54:44 +0000 (15:54 +0100)
committerJames Turner <zakalawe@mac.com>
Fri, 18 Oct 2013 14:54:44 +0000 (15:54 +0100)
Thanks to HomerJ for the catch.

src/Scripting/NasalPositioned.cxx

index 5b5206eedcdd11544e15f036da0382bcc8582030..25d28bb40c1c549c1e168eefddfc0c383d14b9ad 100644 (file)
@@ -1118,7 +1118,11 @@ static naRef f_airport_comms(naContext c, naRef me, int argc, naRef* args)
     naRef comms = naNewVector(c);
     
 // if we have an explicit type, return a simple vector of frequencies
-    if (argc > 0 && naIsScalar(args[0])) {
+    if (argc > 0 && !naIsString(args[0])) {
+        naRuntimeError(c, "airport.comms argument must be a frequency type name");
+    }
+    
+    if (argc > 0) {
         std::string commName = naStr_data(args[0]);
         FGPositioned::Type commType = FGPositioned::typeFromName(commName);