mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 23:23:28 +01:00
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user