ID:2081799
 
Resolved
In rare cases, pick() could try to pull an item from an invalid list index.
BYOND Version:509.1319
Operating System:Linux
Web Browser:Chrome 50.0.2661.94
Applies to:Dream Daemon
Status: Resolved (510.1342)

This issue has been resolved.
Descriptive Problem Summary:
pick() on a single-element list sometimes runtimes with "list index out of bounds"

Numbered Steps to Reproduce Problem:
run the below code (it doesn't happen on 100% of runs, but it should happen within 2-3)

Code Snippet (if applicable) to Reproduce Problem:
/world
loop_checks = 0

/world/New()
for(var/i = 1 to 50)
for(var/k = 1 to 1000000)
pick(list(1))


Expected Results:
No runtime.

Actual Results:

runtime error: list index out of bounds
proc name: New (/world/New)
source file: rand.dme,9
usr: null
src: world
call stack:
world: New()


Does the problem occur:
Every time? Or how often? ~2-3 times in 50M calls.
In other games? Yes.
In other user accounts? Unknown.
On other computers? Yes.

When does the problem NOT occur? When you don't pass a single-element list to pick().

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Unknown

Workarounds: Don't pass single-element lists to pick().

Lummox JR resolved issue with message:
In rare cases, pick() could try to pull an item from an invalid list index.