From 077e200527aa275e63842a645897f2a5e7c20129 Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Wed, 7 Aug 2024 01:01:20 +0200 Subject: [PATCH] Fix crab defender --- maps/crab_defender/main.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/maps/crab_defender/main.lua b/maps/crab_defender/main.lua index c9c48855..21ac04ef 100644 --- a/maps/crab_defender/main.lua +++ b/maps/crab_defender/main.lua @@ -1125,20 +1125,20 @@ local function deny_building(event) return false end -local on_built_entity = function(event) +local on_built_entity = function (event) local get_score = Score.get_table().score_table local this = FDT.get() local entity = event.created_entity + + if not entity or not entity.valid then + return + end local surface = entity.surface if not surface or not surface.valid then return end - if not entity.valid then - return - end - if deny_building(event) then return end