From: oilboi <47129783+oilboi@users.noreply.github.com> Date: Wed, 1 Jul 2020 18:39:51 +0000 (-0400) Subject: Fix possible crashes if null activator index X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=9b547ff83a37f254c6a112ee3107d0e45a19224e;p=Crafter.git Fix possible crashes if null activator index --- diff --git a/mods/redstone/init.lua b/mods/redstone/init.lua index a243e35..74c4f34 100644 --- a/mods/redstone/init.lua +++ b/mods/redstone/init.lua @@ -1,3 +1,5 @@ +--if you attempt to read this, god bless you + local minetest,vector,math,table,pairs,next = @@ -125,6 +127,30 @@ local function data_injection(pos,data) end end +--[[ + _ __ + ___ | ' \ + ___ \ / ___ ,'\_ | .-. \ /| + \ / | |,'__ \ ,'\_ | \ | | | | ,' |_ /| + _ | | | |\/ \ \ | \ | |\_| _ | |_| | _ '-. .-',' |_ _ +// | | | |____| | | |\_|| |__ // | | ,'_`. | | '-. .-',' `. ,'\_ +\\_| |_,' .-, _ | | | | |\ \ // .| |\_/ | / \ || | | | / |\ \| \ + `-. .-'| |/ / | | | | | | \ \// | | | | | || | | | | |_\ || |\_| + | | | || \_| | | | /_\ \ / | |` | | | || | | | | .---'| | + | | | |\___,_\ /_\ _ // | | | \_/ || | | | | | /\| | + /_\ | | //_____// .||` _ `._,' | | | | \ `-' /| | + /_\ `------' \ | /-\ND _ `.\ | | `._,' /_\ + \| |HE `.\ + __ _ _ __ _ + / |__| /_\ |\ /| |_) |_ |_) + \__ | | / \ | \/ | |_) |__ | \ + _ _ + (_)|- ___ __ __ __ + | /\ |__)| |_ (_ + | /--\|__)|__|____) +]]-- + + local table_3d local temp_pool local function create_boundary_box(pos) @@ -299,14 +325,14 @@ local directional_activator = function(pos) if not ignore and ((temp_pool2.dust and temp_pool2.dust > 0) or (temp_pool2.torch and temp_pool2.directional_activator and temp_pool2.dir == temp_pool.dir) or (not temp_pool2.directional_activator and temp_pool2.torch) or (temp_pool2.capacitor and temp_pool2.capacitor > 0)) then - if activator_table[temp_pool.name].activate then + if activator_table[temp_pool.name] and activator_table[temp_pool.name].activate then activator_table[temp_pool.name].activate(pos) return end return end - if activator_table[temp_pool.name].deactivate then + if activator_table[temp_pool.name] and activator_table[temp_pool.name].deactivate then activator_table[temp_pool.name].deactivate(pos) end end