Empty vectors work much better as the result of sorting an empty array

than nil does...
This commit is contained in:
andy
2007-05-02 22:29:35 +00:00
parent 219a7f3a07
commit d645fd6327

View 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];