1
0
mirror of https://github.com/Earu/EasyChat.git synced 2025-03-04 03:13:20 -05:00

fix an error that would happen if no argument is passed to the texture tag

This commit is contained in:
Earu 2022-03-26 16:19:19 +01:00
parent ac587ec18f
commit 9779316148

View File

@ -505,6 +505,12 @@ function texture_part:Ctor(str)
local path = texture_components[1]:Trim()
local mat = Material(path, path:EndsWith(".png") and "nocull noclamp" or nil)
if not mat then
self.Invalid = true
self.TextureSize = math.Clamp(tonumber(texture_components[2]) or draw.GetFontHeight(self.HUD.DefaultFont), 16, 64)
return self
end
local shader = mat:GetShader()
if shader == "VertexLitGeneric" or shader == "Cable" then
local tex_path = mat:GetString("$basetexture")