From f3dd9d5e822cbe97518e27ade0ce72ea8d70a862 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Sat, 11 Apr 2015 11:36:32 -0700 Subject: [PATCH] Fix runtime error with handle_heartbeat() Fixes this runtime error: //-------------------------------------------------\\ || runtime error: Cannot read null.status || || proc name: handle heartbeat || || (/mob/living/carbon/human/proc/handle_heartbeat)|| || source file: life.dm,1648 || \\-------------------------------------------------// This was caused by no sanity check to make sure that internal_organs_by_name actually returned an organ, therefore it was attempting to read a null variable, which causes a runtime error. --- code/modules/mob/living/carbon/human/life.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 132f11bcd08..94f4a93d38b 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1623,6 +1623,10 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc var/client/C = src.client if(C && C.prefs.sound & SOUND_HEARTBEAT) //disable heartbeat by pref var/obj/item/organ/heart/H = internal_organs_by_name["heart"] + + if(!H) //H.status will runtime if there is no H (obviously) + return + if(H.status & ORGAN_ROBOT) //Handle robotic hearts specially with a wuuuubb. This also applies to machine-people. if(shock_stage >= 10 || istype(get_turf(src), /turf/space)) //PULSE_THREADY - maximum value for pulse, currently it 5. @@ -1641,9 +1645,6 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc if(pulse == PULSE_NONE) return - if(!H) - return - if(pulse >= PULSE_2FAST || shock_stage >= 10 || istype(get_turf(src), /turf/space)) //PULSE_THREADY - maximum value for pulse, currently it 5. //High pulse value corresponds to a fast rate of heartbeat.