From f96193317e47299212336f51d93aebb189d0e9a9 Mon Sep 17 00:00:00 2001 From: shadowlord13 Date: Fri, 23 May 2008 05:11:41 +0000 Subject: [PATCH] Fix for an obscure bug - dream daemon throwing an exception due to trying to call null.las_act. (It was calling A.las_act, and A was null. I made it check if (A) first, which should theoretically prevent that from happening unless BYOND actually does run different threads simultaneously. (I haven't seen it happen since making this change, but considering that I never saw it in months before either, it was probably rather rare to begin with) --- main-src/Code/weapons.dm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/main-src/Code/weapons.dm b/main-src/Code/weapons.dm index 1a5c9ea..f6d5b7b 100644 --- a/main-src/Code/weapons.dm +++ b/main-src/Code/weapons.dm @@ -1289,7 +1289,8 @@ /obj/bullet/Bump(atom/A as mob|obj|turf|area) spawn( 0 ) - A.las_act("bullet", src) + if (A) //fix for an odd bug whose cause I'm not certain of - I once saw the dream daemon console throw an exception in the A.las_act() line due to A being null. How the bullet managed to bump into null I do not know, but this might make it less likely. Best guess: Two bullets in the same cycle hit something whose las_act deleted it. -shadowlord13 + A.las_act("bullet", src) //SN src = null del(src) return @@ -1321,7 +1322,8 @@ /obj/beam/a_laser/Bump(atom/A as mob|obj|turf|area) spawn( 0 ) - A.las_act(null, src) + if (A) //fix for an odd bug whose cause I'm not certain of - I once saw the dream daemon console throw an exception in the A.las_act() line due to A being null. How the bullet managed to bump into null I do not know, but this might make it less likely. Best guess: Two bullets in the same cycle hit something whose las_act deleted it. -shadowlord13 + A.las_act(null, src) //SN src = null del(src) return @@ -1329,14 +1331,17 @@ return /obj/beam/a_laser/proc/process() - + //world << text("laser at [] []:[], target is [] []:[]", src.loc, src.x, src.y, src:current, src.current:x, src.current:y) if ((!( src.current ) || src.loc == src.current)) - src.current = locate(min(max(src.x + src.xo, 1), world.maxx), min(max(src.y + src.yo, 1), world.maxy), src.z) + src.current = locate(min(max(src.x + src.xo, 1), world.maxx), min(max(src.y + src.yo, 1), world.maxy), src.z) + //world << text("current changed: target is now []. location was [],[], added [],[]", src.current, src.x, src.y, src.xo, src.yo) if ((src.x == 1 || src.x == world.maxx || src.y == 1 || src.y == world.maxy)) + //world << text("off-world, deleting") //SN src = null del(src) return step_towards(src, src.current) + //world << text("laser stepped, now [] []:[], target is [] []:[]", src.loc, src.x, src.y, src.current, src.current:x, src.current:y) src.life-- if (src.life <= 0) //SN src = null