Skip to content

Commit d391d48

Browse files
authored
Markervision: Fixed another null entity error (#1837)
This PR fixes the following error: ``` [REDACTED] Lua Error: [TTT2 (Base) - v0.14.5b] lua/ttt2/libraries/marker_vision.lua:54: Tried to use a NULL entity! 1. AddEFlags - [C]:-1 2. Add - lua/ttt2/libraries/marker_vision.lua:54 3. callback - lua/ttt2/libraries/marker_vision.lua:230 4. func - lua/ttt2/extensions/net.lua:206 5. unknown - lua/includes/extensions/net.lua:34 ``` The null entity error was introduced in #1825 . I tested it and I couldn't reproduce the above error again. (I fixed a similar error in the following PR but I didn't notice the other error: #1835 )
1 parent 20c8c45 commit d391d48

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
1414

1515
### Fixed
1616

17-
- Fixed markerVision null entity error (by @mexikoedi)
17+
- Fixed markerVision null entity errors (by @mexikoedi)
1818

1919
## [v0.14.5b](https://github.com/TTT-2/TTT2/tree/v0.14.5b) (2025-08-18)
2020

lua/ttt2/libraries/marker_vision.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ function markerVision.Add(ent, identifier)
4646
-- Overwrite the entity's UpdateTransmitState function to TRANSMIT_ALWAYS.
4747
-- This is necessary because otherwise the entity might get culled.
4848
-- Before we overwrite the function, we save the old function to restore it later.
49-
ent.ttt2MVTransmitOldFunc = ent.UpdateTransmitState
49+
if IsValid(ent) then
50+
ent.ttt2MVTransmitOldFunc = ent.UpdateTransmitState
5051

51-
ent.UpdateTransmitState = function()
52-
return TRANSMIT_ALWAYS
52+
ent.UpdateTransmitState = function()
53+
return TRANSMIT_ALWAYS
54+
end
55+
ent:AddEFlags(EFL_FORCE_CHECK_TRANSMIT)
5356
end
54-
ent:AddEFlags(EFL_FORCE_CHECK_TRANSMIT)
5557

5658
return mvObject
5759
end

0 commit comments

Comments
 (0)