Skip to content

Commit 29816ed

Browse files
authored
Fix CPPI errors (#3477)
Fixes #3476
1 parent c8f18e2 commit 29816ed

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lua/entities/base_wire_entity.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ if CLIENT then
159159
local name
160160
if CPPI then
161161
local owner = self:CPPIGetOwner()
162-
name = string.format("(%s)", (isentity(owner) and owner:IsPlayer()) and owner:GetName() or "World")
162+
name = string.format("(%s)", IsValid(owner) and owner:Nick() or "World")
163163
else
164164
name = "(" .. self:GetPlayerName() .. ")"
165165
end

lua/wire/client/text_editor/wire_expression2_editor.lua

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,10 +1461,16 @@ Text here]# ]]
14611461

14621462
local label = vgui.Create("DLabel", panel)
14631463
local idx = v:EntIndex()
1464-
14651464
local ownerStr
1466-
if CPPI and v:CPPIGetOwner():GetName() ~= nick then
1467-
ownerStr = string.format("Owner: %s | Code Author: %s", v:CPPIGetOwner():GetName(), nick)
1465+
1466+
if CPPI then
1467+
local owner = self:CPPIGetOwner()
1468+
1469+
if IsValid(owner) and owner:Nick() ~= nick then
1470+
ownerStr = string.format("Owner: %s | Code Author: %s", owner:GetName(), nick)
1471+
else
1472+
ownerStr = "Owner: " .. nick
1473+
end
14681474
else
14691475
ownerStr = "Owner: " .. nick
14701476
end

0 commit comments

Comments
 (0)