From ccfbc7da141a46e70631cc0851c0f0e34debf455 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 24 Aug 2022 02:56:37 +0200 Subject: [PATCH] Make sure math.random gets a >0 argument --- mods/ENTITIES/mcl_mobs/api.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index b3dd76e17..ea93915a5 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3467,7 +3467,10 @@ local mob_activate = function(self, staticdata, def, dtime) def.textures = {def.textures} end - self.base_texture = def.textures[random(1, #def.textures)] + local c = 1 + if #def.textures > c then c = #def.textures end + + self.base_texture = def.textures[math.random(c)] self.base_mesh = def.mesh self.base_size = self.visual_size self.base_colbox = self.collisionbox