From c1536fe5b4bc2975235555d6ef91edb3859b3716 Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Fri, 10 Dec 2021 22:47:30 +0100 Subject: [PATCH] Biter health booster - more checks --- modules/biter_health_booster_v2.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/biter_health_booster_v2.lua b/modules/biter_health_booster_v2.lua index ea826d2f..488acfb6 100644 --- a/modules/biter_health_booster_v2.lua +++ b/modules/biter_health_booster_v2.lua @@ -201,6 +201,9 @@ local function clean_table() end local surface = game.surfaces[this.active_surface] + if not (surface and surface.valid) then + return + end for _, unit in pairs(surface.find_entities_filtered({type = validTypes})) do units_to_delete[unit.unit_number] = nil @@ -484,7 +487,7 @@ end function Public.set_active_surface(str) if str and type(str) == 'string' then this.active_surfaces = {} - this.active_surface = str + this.active_surface = str or 'nauvis' end return this.active_surface end