Add null checks to client prefs checks

client.prefs. -> client?.prefs?.
This commit is contained in:
psq95
2023-05-13 23:53:47 +01:00
parent dfeb85bfa4
commit 5840c8ab99
93 changed files with 310 additions and 310 deletions
+1 -1
View File
@@ -104,7 +104,7 @@
if(M.client)
body += "| <A href='?_src_=holder;[HrefToken()];sendtoprison=[REF(M)]'>Prison</A> | "
body += "\ <A href='?_src_=holder;[HrefToken()];sendbacktolobby=[REF(M)]'>Send back to Lobby</A> | "
var/muted = M.client.prefs.muted
var/muted = M.client?.prefs?.muted
body += "<br><b>Mute: </b> "
body += "\[<A href='?_src_=holder;[HrefToken()];mute=[M.ckey];mute_type=[MUTE_IC]'><font color='[(muted & MUTE_IC)?"red":"blue"]'>IC</font></a> | "
body += "<A href='?_src_=holder;[HrefToken()];mute=[M.ckey];mute_type=[MUTE_OOC]'><font color='[(muted & MUTE_OOC)?"red":"blue"]'>OOC</font></a> | "
+1 -1
View File
@@ -743,7 +743,7 @@
if (length(players))
var/mob/chosen = players[1]
if (chosen.client)
chosen.client.prefs.copy_to(spawnedMob)
chosen.client?.prefs?.copy_to(spawnedMob)
spawnedMob.key = chosen.key
players -= chosen
if (ishuman(spawnedMob) && ispath(humanoutfit, /datum/outfit))
+1 -1
View File
@@ -142,7 +142,7 @@
if(SOUND_EMITTER_GLOBAL)
hearing_mobs = GLOB.player_list.Copy()
for(var/mob/M in hearing_mobs)
if(M.client.prefs.toggles & SOUND_MIDI)
if(M.client?.prefs?.toggles & SOUND_MIDI)
M.playsound_local(M, sound_file, sound_volume, FALSE, channel = CHANNEL_ADMIN, pressure_affected = FALSE)
if(user)
log_admin("[ADMIN_LOOKUPFLW(user)] activated a sound emitter with file \"[sound_file]\" at [AREACOORD(src)]")
+1 -1
View File
@@ -26,7 +26,7 @@
for (var/mob/M in GLOB.player_list)
if(isnewplayer(M))
continue
if (M.stat == DEAD || (M.client && M.client.holder && (M.client.prefs.chat_toggles & CHAT_DEAD))) //admins can toggle deadchat on and off. This is a proc in admin.dm and is only give to Administrators and above
if (M.stat == DEAD || (M.client && M.client.holder && (M.client?.prefs?.chat_toggles & CHAT_DEAD))) //admins can toggle deadchat on and off. This is a proc in admin.dm and is only give to Administrators and above
to_chat(M, rendered)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Dsay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
+2 -2
View File
@@ -32,7 +32,7 @@
/datum/admins/proc/isReadytoRumble(mob/living/carbon/human/applicant, targetrole, onstation = TRUE, conscious = TRUE)
if(applicant.mind.special_role)
return FALSE
if(!(targetrole in applicant.client.prefs.be_special))
if(!(targetrole in applicant.client?.prefs?.be_special))
return FALSE
if(onstation)
var/turf/T = get_turf(applicant)
@@ -412,7 +412,7 @@
//Spawn the body
var/mob/living/carbon/human/ERTOperative = new ertemplate.mobtype(spawnloc)
chosen_candidate.client.prefs.copy_to(ERTOperative)
chosen_candidate.client?.prefs?.copy_to(ERTOperative)
ERTOperative.key = chosen_candidate.key
if(ertemplate.enforce_human || ERTOperative.dna.species.dangerous_existence) // Don't want any exploding plasmemes
+1 -1
View File
@@ -33,7 +33,7 @@
message_admins("[key_name_admin(src)] played sound [S]")
for(var/mob/M in GLOB.player_list)
if(M.client.prefs.toggles & SOUND_MIDI)
if(M.client?.prefs?.toggles & SOUND_MIDI)
var/user_vol = M.client.chatOutput.adminMusicVolume
if(user_vol)
admin_sound.volume = vol * (user_vol / 100)
+1 -1
View File
@@ -11,7 +11,7 @@
return
log_prayer("[src.key]/([src.name]): [msg]")
if(usr.client)
if(usr.client.prefs.muted & MUTE_PRAY)
if(usr.client?.prefs?.muted & MUTE_PRAY)
to_chat(usr, "<span class='danger'>You cannot pray (muted).</span>")
return
if(src.client.handle_spam_prevention(msg,MUTE_PRAY))
+1 -1
View File
@@ -288,7 +288,7 @@
for(var/mob/M in GLOB.player_list)
if(M.stat != DEAD)
continue //we are not dead!
if(!(ROLE_ALIEN in M.client.prefs.be_special))
if(!(ROLE_ALIEN in M.client?.prefs?.be_special))
continue //we don't want to be an alium
if(M.client.is_afk())
continue //we are afk