]> git.mxchange.org Git - simgear.git/commitdiff
Empty vectors work much better as the result of sorting an empty array
authorandy <andy>
Wed, 2 May 2007 22:29:35 +0000 (22:29 +0000)
committerandy <andy>
Wed, 2 May 2007 22:29:35 +0000 (22:29 +0000)
than nil does...

simgear/nasal/lib.c

index 0d7265b73e4f67f7ae76be27391a6a58819e7d21..ff35104c90a36ee1d689b5b3527d7aff0097ddf2 100644 (file)
@@ -514,7 +514,7 @@ static naRef f_sort(naContext c, naRef me, int argc, naRef* args)
     if(argc != 2 || !naIsVector(args[0]) || !naIsFunc(args[1]))
         naRuntimeError(c, "bad/missing argument to sort()");
     sd.subc = naSubContext(c);
-    if(!PTR(args[0]).vec->rec) return naNil();
+    if(!PTR(args[0]).vec->rec) return naNewVector(c);
     sd.elems = PTR(args[0]).vec->rec->array;
     sd.n = PTR(args[0]).vec->rec->size;
     sd.fn = args[1];