From 4746f20f3552078bbcecd47ae8b9e1956e3ffd63 Mon Sep 17 00:00:00 2001 From: "johnsonmt88@gmail.com" Date: Thu, 8 Nov 2012 23:25:41 +0000 Subject: [PATCH] A couple of runtime fixes: Runtime fix for Poly searching for items (runtime error: Cannot read null.w_class) Runtime fix for safe lock-picking (runtime error: Cannot read null.len) git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5030 316c924e-a436-60f5-8080-3fe189b3f50e --- code/__HELPERS/lists.dm | 2 +- code/modules/mob/living/simple_animal/parrot.dm | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm index 501a6d8c473..620bd33d2b3 100644 --- a/code/__HELPERS/lists.dm +++ b/code/__HELPERS/lists.dm @@ -307,6 +307,6 @@ proc/listclearnulls(list/list) return r /proc/safe_pick_list(var/list/L) - if(L.len) + if(L && L.len) return pick(L) return null \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index 49b15937d9c..14693cbd66f 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -529,7 +529,7 @@ if(iscarbon(AM)) var/mob/living/carbon/C = AM - if(C.l_hand.w_class <= 2 || C.r_hand.w_class <= 2) + if((C.l_hand && C.l_hand.w_class <= 2) || (C.r_hand && C.r_hand.w_class <= 2)) return C return null @@ -558,7 +558,7 @@ if(iscarbon(AM)) var/mob/living/carbon/C = AM - if(C.l_hand.w_class <= 2 || C.r_hand.w_class <= 2) + if(C.l_hand && C.l_hand.w_class <= 2 || C.r_hand && C.r_hand.w_class <= 2) return C return null @@ -609,10 +609,10 @@ var/obj/item/stolen_item = null for(var/mob/living/carbon/C in view(1,src)) - if(C.l_hand.w_class <= 2) + if(C.l_hand && C.l_hand.w_class <= 2) stolen_item = C.l_hand - if(C.r_hand.w_class <= 2) + if(C.r_hand && C.r_hand.w_class <= 2) stolen_item = C.r_hand if(stolen_item)