From 0b8e1f62bb38a23e10e09f28ba3bc5ec76f98b8f Mon Sep 17 00:00:00 2001 From: "quartz235@gmail.com" Date: Sat, 25 Feb 2012 04:02:24 +0000 Subject: [PATCH] (hopefully) fixes a runtime causing the server to shit itself and crash immediately git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3190 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/recycling/disposal.dm | 71 ++++++++++++++++-------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 8551fd0420..75ecf18613 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -372,17 +372,18 @@ var/turf/target playsound(src, 'hiss.ogg', 50, 0, 0) - for(var/atom/movable/AM in H) - target = get_offset_target_turf(src.loc, rand(5)-rand(5), rand(5)-rand(5)) + if(H) // Somehow, someone managed to flush a window which broke mid-transit and caused the disposal to go in an infinite loop trying to expel null, hopefully this fixes it + for(var/atom/movable/AM in H) + target = get_offset_target_turf(src.loc, rand(5)-rand(5), rand(5)-rand(5)) - AM.loc = src.loc - AM.pipe_eject(0) - spawn(1) - if(AM) - AM.throw_at(target, 5, 1) + AM.loc = src.loc + AM.pipe_eject(0) + spawn(1) + if(AM) + AM.throw_at(target, 5, 1) - H.vent_gas(loc) - del(H) + H.vent_gas(loc) + del(H) CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if (istype(mover,/obj/item)) @@ -738,29 +739,31 @@ target = get_ranged_target_turf(T, direction, 10) playsound(src, 'hiss.ogg', 50, 0, 0) - for(var/atom/movable/AM in H) - AM.loc = T - AM.pipe_eject(direction) - spawn(1) - if(AM) - AM.throw_at(target, 100, 1) - H.vent_gas(T) - del(H) + if(H) + for(var/atom/movable/AM in H) + AM.loc = T + AM.pipe_eject(direction) + spawn(1) + if(AM) + AM.throw_at(target, 100, 1) + H.vent_gas(T) + del(H) else // no specified direction, so throw in random direction playsound(src, 'hiss.ogg', 50, 0, 0) - for(var/atom/movable/AM in H) - target = get_offset_target_turf(T, rand(5)-rand(5), rand(5)-rand(5)) + if(H) + for(var/atom/movable/AM in H) + target = get_offset_target_turf(T, rand(5)-rand(5), rand(5)-rand(5)) - AM.loc = T - AM.pipe_eject(0) - spawn(1) - if(AM) - AM.throw_at(target, 5, 1) + AM.loc = T + AM.pipe_eject(0) + spawn(1) + if(AM) + AM.throw_at(target, 5, 1) - H.vent_gas(T) // all gas vent to turf - del(H) + H.vent_gas(T) // all gas vent to turf + del(H) return @@ -1174,14 +1177,14 @@ sleep(20) //wait until correct animation frame playsound(src, 'hiss.ogg', 50, 0, 0) - - for(var/atom/movable/AM in H) - AM.loc = src.loc - AM.pipe_eject(dir) - spawn(1) - AM.throw_at(target, 3, 1) - H.vent_gas(src.loc) - del(H) + if(H) + for(var/atom/movable/AM in H) + AM.loc = src.loc + AM.pipe_eject(dir) + spawn(1) + AM.throw_at(target, 3, 1) + H.vent_gas(src.loc) + del(H) return