ID:1907133
 
(See the best response by Nadrew.)
Code:
runtime error: Cannot read null.x
proc name: loop (/light/proc/loop)
source file: light-source.dm,84
usr: null
src: the day night (/light/day_night)
call stack:
the day night (/light/day_night): loop()
/Lighting (/Lighting): loop()
/Lighting (/Lighting): New()


Problem description: Getting this run-time on log-out...maybe just another example of me using the library incorrectly; I can get the full runtime errors from DD since the chat nor options wouldn't give full runtime errors. Don't really know how to fix it or what the issue really is other than 'null usr'.
You'd have to check line 84 of "light-source.dm", chances are you're using 'usr.x' around there somewhere, but 'usr' becomes null when you're logging out, probably in the middle of the process. You can prevent the runtime by checking if usr exists before trying to interact with it.
Yes, my apologies I should of done that. Here is the loop (the problem I am seeing is that, while hosting the world (it is intended to be persistent), when I logout and the world is still up it gets this runtime error which I think is from not clearing the logging out users light source correctly? No clue how to fix though, I'm not primarily a programmer I just squeak by). P.S. this is from a version of Forum_accounts lighting library.
proc
// this used to be called be an infinite loop that was local to
// the light object, but now there is a single infinite loop in
// the global lighting object that calls this proc.
loop()

// if the light is mobile (if it was attached to an atom of
// type /atom/movable), check to see if the owner has moved
if(mobile)

// compute the owner's coordinates
var/opx = owner.x
var/opy = owner.y

// if pixel movement is enabled we need to take step_x
// and step_y into account
if(lighting.pixel_movement)
opx += owner:step_x / 32
opy += owner:step_y / 32

// see if the owner's coordinates match
if(opx != __x || opy != __y)
__x = opx
__y = opy
changed = 1

if(changed==1)
apply()

apply()

changed = 0
Best response
You should be able to change

if(mobile)


to

if(mobile && owner)


To prevent the error, if the mob is being properly handled on Logout() it should be clearing variables and references, but if light sources are being handled externally you'll need to get rid of the light inside of Logout() before calling ..() or del().
Okay, that cleared up this run-time error. Thank you.
Still testing it, I appreciate your efforts.
Always amazes me how small and simple the bug fix is and that I never see it unless I spend days and days fiddling around randomly placing things in places.