Add null checks

This commit is contained in:
psq95
2023-05-13 23:50:13 +01:00
parent b0d6c82c79
commit dfeb85bfa4
5 changed files with 20 additions and 19 deletions
+4 -4
View File
@@ -91,7 +91,7 @@
//Second link in a breath chain, calls check_breath()
/mob/living/carbon/proc/breathe()
var/obj/item/organ/lungs = getorganslot(ORGAN_SLOT_LUNGS)
if(reagents.has_reagent(/datum/reagent/toxin/lexorin))
if(reagents?.has_reagent(/datum/reagent/toxin/lexorin))
return
if(istype(loc, /obj/machinery/atmospherics/components/unary/cryo_cell))
return
@@ -167,7 +167,7 @@
//CRIT
if(!breath || (breath.total_moles() == 0) || !lungs)
if(reagents.has_reagent(/datum/reagent/medicine/epinephrine) && lungs)
if(reagents?.has_reagent(/datum/reagent/medicine/epinephrine) && lungs)
return
adjustOxyLoss(1)
@@ -389,7 +389,7 @@
return
// No decay if formaldehyde in corpse or when the corpse is charred
if(reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 15) || HAS_TRAIT(src, TRAIT_HUSK))
if(reagents?.has_reagent(/datum/reagent/toxin/formaldehyde, 15) || HAS_TRAIT(src, TRAIT_HUSK))
return
// Also no decay if corpse chilled or not organic/undead
@@ -432,7 +432,7 @@
if(O)
O.on_life()
else
if(reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 1)) // No organ decay if the body contains formaldehyde.
if(reagents?.has_reagent(/datum/reagent/toxin/formaldehyde, 1)) // No organ decay if the body contains formaldehyde.
return
for(var/V in internal_organs)
var/obj/item/organ/O = V
+1 -1
View File
@@ -494,7 +494,7 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA
if (!(client.prefs.chat_toggles & CHAT_OOC) && isdead(new_mob))
client.prefs.chat_toggles ^= CHAT_OOC
new_mob.ckey = ckey
new_mob.client.init_verbs()
new_mob.client?.init_verbs()
if(send_signal)
SEND_SIGNAL(src, COMSIG_MOB_KEY_CHANGE, new_mob, src)
return TRUE
+1 -1
View File
@@ -316,7 +316,7 @@
on_mob.forceMove(scanning)
for(var/i in 1 to light_beam_distance)
scanning = get_step(scanning, scandir)
if(scanning.opacity || scanning.has_opaque_atom)
if(scanning?.opacity || scanning?.has_opaque_atom)
stop = TRUE
var/obj/effect/abstract/eye_lighting/L = LAZYACCESS(eye_lighting, i)
if(stop)