Fix crash when sorting newly-allocated empty vectors

This commit is contained in:
andy
2007-05-02 22:24:45 +00:00
parent d95e3e0055
commit 219a7f3a07

View File

@@ -514,6 +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();
sd.elems = PTR(args[0]).vec->rec->array;
sd.n = PTR(args[0]).vec->rec->size;
sd.fn = args[1];