Passing a negative array length to the schedule method of a job doesn't throw an error

I’m quite embarrassed that I’ve done this to myself but equally surprised that I can tell a job to run with a negative array length which effectively makes it not run at all.

I want to submit a bug report but I first want to hear if this is by design or if there’s any justification to this? I can’t imagine I’m the first idiot to accidentally pass a negative number as the array length argument in the years that the job system has been production ready.

I can’t imagine a reason why 0 or less should be allowed as valid input.

I am sorry but… math.abs(length) :sweat_smile:

yeah. i get that. my point is that 0 or less should be an invalid argument.

1 Like

0 is a perfectly valid array size and should not throw an error. If I use ToComponentDataArray on an empty EntityQuery and then schedule a parallel job based on that, I don’t want errors. I just want the job to early out. This is an oversimplified example use case, but I can assure you there are real-world use cases where this is important.

Negative numbers is a different matter.

3 Likes