SprayMesh Extended: Fix layout breaking if adding an existing spray

It used old code where the spray was inside a container panel.

The container panel isn't used anymore, calling GetParent would mistakenly remove the DIconLayout
This commit is contained in:
Chev 2025-04-19 22:35:58 -07:00
parent 421e33b6f6
commit efb61d9672
Signed by: chev2
GPG key ID: 0B212D6AED495EC9

View file

@ -362,8 +362,8 @@ local MAT_FAKE_TRANSPARENT = Material("spraymesh/fake_transparent.png", "noclamp
function PANEL:AddSpray(url, name)
-- If the spray already exists
local existingSpray = self.Sprays[url]
if existingSpray and IsValid(existingSpray) and IsValid(existingSpray:GetParent()) then
existingSpray:GetParent():Remove()
if existingSpray and IsValid(existingSpray) then
existingSpray:Remove()
self.Sprays[url] = nil
end