ID:264412
 
Code:
        retarget(mob/m,x)
del(img["TARGET"])
trg=null
if(!m)return
trg=m
img["TARGET"]=image('HUD.dmi',trg,"target")
src<<img["TARGET"]
TargetL()
TargetL()
src<<output("Target Locked","grid2:1,1")
src<<output("[trg.name]","grid2:1,2")
src<<output("Health:[num2ttext(trg.hp)]/[num2ttext(trg.maxhp)]","grid2:1,3")
src<<output("Ki Energy:[num2ttext(trg.ki)]/[num2ttext(trg.maxki)]","grid2:1,4")
src<<output("Strength:[num2ttext(trg.str)]","grid2:1,5")
src<<output("Defence:[num2ttext(trg.def)]","grid2:1,6")
spawn (10) .()


Problem description:
After the monster is defeated, I get this runtime error:
runtime error: Cannot read null.name
proc name: TargetL (/mob/player/proc/TargetL)
source file: Panel and Grid.dm,59
usr: Saibaman (/mob/enemy/Saibaman)
src: Child Prodigy (/mob/player)
call stack:
Child Prodigy (/mob/player): TargetL()
Child Prodigy (/mob/player): TargetL()
That'd be because the 'trg' variable is becoming null - that is, it's a reference to nothing.

Depending on how you want this, there are a number of solutions. Probably the simplest is probably to just stick the code:

if(!trg) return


at the start of TargetL(). That checks if trg exists, and exits the function if it doesn't.
In response to Jp (#1)
Thanks a bunch, it works