ID:1810234
 
BYOND Version:507
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Chrome 40.0.2214.115
Applies to:Dream Seeker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:

Attempting to index a null reference reports 'bad index' as a runtime error, as opposed to null reference. This is counter-intuitive, because it points you toward the wrong problem.

Code Snippet (if applicable) to Reproduce Problem:
var/list/l
l["herp"] = "derp"


Expected Results:

The runtime error should report the source of the error, not the symptom of the error.

Actual Results:

The runtime error indicates the wrong problem.

Workarounds:

Don't cause the runtime in the first place.


But seriously, this is just a minor oversight in the way the interpreter catches and handles errors during indexing. Instead of assuming that the index is at fault, the label being indexed should be checked to see if it is null first, in order to return a null reference error prior to assuming the index itself is bad. While yes, a bad index is a valid description of the problem, the runtime error is ambiguous compared to how other languages report this minor oversight.
I just encountered this weirdness and I want to bump this. I think the error should better reflect the problem. Had I encountered this in a production scenario instead of through testing, I imagine the issue may have cost me an unnecessary amount of time to pinpoint because of the misleading error.