From d14ee50ccde7b6b355cad9d696fd8dd2209aae86 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sun, 19 Feb 2017 04:04:16 -0800 Subject: [PATCH 1/2] Adds checks to prevent runtime in playtime list if mob has no mind Currently, if you use 'Check Player Playtime' before roundstart, you can get a runtime like this: [07:00:59] Runtime in job_exp.dm,16: Cannot read null.assigned_role proc name: Check Player Playtime (/client/proc/cmd_mentor_check_player_exp) usr: CHARACTER (CKEY) (/mob/dead/observer) usr.loc: The floor (41,145,1) (/turf/simulated/shuttle/floor) This PR fixes it so that runtime should no longer be possible, by checking that C.mob.mind exists before checking whether C.mob.mind.assigned_role exists. --- code/game/jobs/job_exp.dm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/code/game/jobs/job_exp.dm b/code/game/jobs/job_exp.dm index e0b403bfce7..936eb1b09c4 100644 --- a/code/game/jobs/job_exp.dm +++ b/code/game/jobs/job_exp.dm @@ -13,12 +13,13 @@ var/jtext for(var/client/C in clients) jtext = "No Job" - if(C.mob.mind.assigned_role) - theirjob = job_master.GetJob(C.mob.mind.assigned_role) - if(theirjob) - jtext = theirjob.title - if(config.use_exp_restrictions && theirjob.exp_requirements && theirjob.exp_type) - jtext += "*" + if(C.mob.mind) + if(C.mob.mind.assigned_role) + theirjob = job_master.GetJob(C.mob.mind.assigned_role) + if(theirjob) + jtext = theirjob.title + if(config.use_exp_restrictions && theirjob.exp_requirements && theirjob.exp_type) + jtext += "*" if(check_rights(R_ADMIN)) pline = "
  • [key_name_admin(C.mob)]: [jtext]: " + C.get_exp_living() + "
  • " else From edfd178e3509f96391c3131869a7a7ccd142b5f9 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sun, 19 Feb 2017 15:16:28 -0800 Subject: [PATCH 2/2] Line condense --- code/game/jobs/job_exp.dm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/code/game/jobs/job_exp.dm b/code/game/jobs/job_exp.dm index 936eb1b09c4..57146664b67 100644 --- a/code/game/jobs/job_exp.dm +++ b/code/game/jobs/job_exp.dm @@ -13,13 +13,12 @@ var/jtext for(var/client/C in clients) jtext = "No Job" - if(C.mob.mind) - if(C.mob.mind.assigned_role) - theirjob = job_master.GetJob(C.mob.mind.assigned_role) - if(theirjob) - jtext = theirjob.title - if(config.use_exp_restrictions && theirjob.exp_requirements && theirjob.exp_type) - jtext += "*" + if(C.mob.mind && C.mob.mind.assigned_role) + theirjob = job_master.GetJob(C.mob.mind.assigned_role) + if(theirjob) + jtext = theirjob.title + if(config.use_exp_restrictions && theirjob.exp_requirements && theirjob.exp_type) + jtext += "*" if(check_rights(R_ADMIN)) pline = "
  • [key_name_admin(C.mob)]: [jtext]: " + C.get_exp_living() + "
  • " else