]> git.lizzy.rs Git - Crafter.git/commitdiff
Fix possible crashes if null activator index
authoroilboi <47129783+oilboi@users.noreply.github.com>
Wed, 1 Jul 2020 18:39:51 +0000 (14:39 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Wed, 1 Jul 2020 18:39:51 +0000 (14:39 -0400)
mods/redstone/init.lua

index a243e3567e355ebbfdb8780363389f07395e5c6e..74c4f34f5a593cb1c8703a5a8a9387515999b06a 100644 (file)
@@ -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