From 7023f734eab3c0fa44fecaf428446dc47dc2083c Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Tue, 17 Jul 2012 16:43:03 +0000 Subject: [PATCH] Fix for the following runtime. runtime error: Cannot read null.viruses proc name: cure (/datum/disease/proc/cure) source file: disease.dm,156 usr: null src: The Flu (/datum/disease/flu) call stack: The Flu (/datum/disease/flu): cure(0) git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4097 316c924e-a436-60f5-8080-3fe189b3f50e --- code/datums/disease.dm | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/code/datums/disease.dm b/code/datums/disease.dm index 55422070fcf..83dfbd7e95f 100644 --- a/code/datums/disease.dm +++ b/code/datums/disease.dm @@ -145,18 +145,14 @@ to null does not delete the object itself. Thank you. return /datum/disease/proc/cure(var/resistance=1)//if resistance = 0, the mob won't develop resistance to disease - if(resistance && affected_mob && !(type in affected_mob.resistances)) -// world << "Setting res to [src]" - var/saved_type = "[type]"//copy the value, not create the reference to it, so when the object is deleted, the value remains. - affected_mob.resistances += text2path(saved_type) - if((affected_mob) && (istype(src, /datum/disease/alien_embryo)))//Get rid of the flag. - affected_mob.status_flags &= ~(XENO_HOST) -// world << "Removing [src]" - spawn(0) - affected_mob.viruses -= src //I am a silly person for trying affected_mob.viruses.Find(src_type) instead of what it's like now and getting LOL WHAT IS THIS PROC - del(src) //IT'LL TAKE MORE THAN A LIST REMOVE TO DEFEAT US! - //world <<"Virus deleted successfully." - //world <<"Cured the disease, deleting virus..." + if(affected_mob) + if(resistance && !(type in affected_mob.resistances)) + var/saved_type = "[type]" + affected_mob.resistances += text2path(saved_type) + if(istype(src, /datum/disease/alien_embryo)) //Get rid of the infection flag if it's a xeno embryo. + affected_mob.status_flags &= ~(XENO_HOST) + affected_mob.viruses -= src //remove the datum from the list + del(src) //delete the datum to stop it processing return