Attempting to return the value of a pointer in a datum results in a Cannot Read null.var runtime error. This occurs even if the pointer is pointing to a var in the datum.
Code Snippet (if applicable) to Reproduce Problem:
var/a=7
test datum
var/b=0
New()
b=&a
proc/returnb()
return *b
mob/var/testdatum/test = new
mob
Login()
..()
world << "[a]"
world << "________"
world << "[test.returnb()]"
Expected Results: Returns the value of a.
Actual Results: runtimes with a Cannot read null.b
Does the problem occur:
Everytime.
When does the problem NOT occur?
Only when you access b before attempting to return it.
Workarounds:
proc/returnb()
var/temp = b
return *b
Replacing this with the returnb in code properly returns b as a pointer.