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

fix some crashes [ci skip]

This commit is contained in:
Earu 2022-04-24 13:30:23 +02:00
parent ea0c4208f9
commit 713b1e5dde
2 changed files with 53 additions and 2 deletions

View File

@ -492,6 +492,18 @@ chathud:RegisterPart("zrotate", z_rotate_part)
Shows a texture in the chat.
]]-------------------------------------------------------------------------------
local texture_allowed_shaders = {
UnlitGeneric = true,
VertexLitGeneric = true,
Wireframe = true,
Refract_DX90 = true,
Water_DX90 = true,
Sky_DX9 = true,
gmodscreenspace = true,
Modulate_DX9 = true,
Cable = true
}
local texture_part = {
RealPos = { X = 0, Y = 0 },
Usage = "<texture=path, size?>",
@ -504,8 +516,6 @@ function texture_part:Ctor(str)
local texture_components = str:Split(",")
local path = texture_components[1]:Trim()
if path:lower():match("^debug%/") then path = "" end -- invalidate debug textures, crashy
local mat = Material(path, path:EndsWith(".png") and "nocull noclamp" or nil)
if not mat then
self.Invalid = true
@ -514,6 +524,7 @@ function texture_part:Ctor(str)
end
local shader = mat:GetShader()
if not texture_allowed_shaders[shader] then self.Invalid = true end
if shader == "VertexLitGeneric" or shader == "Cable" then
local tex_path = mat:GetString("$basetexture")
if tex_path then

40
oc2y9b.patch Normal file
View File

@ -0,0 +1,40 @@
diff --git a/lua/easychat/modules/extra_tags.lua b/lua/easychat/modules/extra_tags.lua
index b84014f..7f691de 100644
--- a/lua/easychat/modules/extra_tags.lua
+++ b/lua/easychat/modules/extra_tags.lua
@@ -492,6 +492,18 @@ chathud:RegisterPart("zrotate", z_rotate_part)
Shows a texture in the chat.
]]-------------------------------------------------------------------------------
+local texture_allowed_shaders = {
+ UnlitGeneric = true,
+ VertexLitGeneric = true,
+ Wireframe = true,
+ Refract_DX90 = true,
+ Water_DX90 = true,
+ Sky_DX9 = true,
+ gmodscreenspace = true,
+ Modulate_DX9 = true,
+ Cable = true
+}
+
local texture_part = {
RealPos = { X = 0, Y = 0 },
Usage = "<texture=path, size?>",
@@ -504,8 +516,6 @@ function texture_part:Ctor(str)
local texture_components = str:Split(",")
local path = texture_components[1]:Trim()
- if path:lower():match("^debug%/") then path = "" end -- invalidate debug textures, crashy
-
local mat = Material(path, path:EndsWith(".png") and "nocull noclamp" or nil)
if not mat then
self.Invalid = true
@@ -514,6 +524,7 @@ function texture_part:Ctor(str)
end
local shader = mat:GetShader()
+ if not texture_allowed_shaders[shader] then self.Invalid = true end
if shader == "VertexLitGeneric" or shader == "Cable" then
local tex_path = mat:GetString("$basetexture")
if tex_path then