Skip to content

Commit

Permalink
Fix sending 0-length strings (#3160)
Browse files Browse the repository at this point in the history
  • Loading branch information
Denneisk authored Oct 27, 2024
1 parent 26aed14 commit 2f5a890
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lua/entities/gmod_wire_egp/lib/objects/text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Obj.Transmit = function( self, Ent, ply )
EGP.SendPosAng(self)
local len = #self.text
if len <= 1024 then
net.WriteUInt(len, 11)
net.WriteUInt(len + 1, 11)
net.WriteData(self.text, len)
else
net.WriteUInt(0, 11)
Expand All @@ -116,8 +116,9 @@ Obj.Receive = function( self )
local tbl = {}
EGP.ReceivePosAng(tbl)
local len = net.ReadUInt(11)
local text = net.ReadData(len)
tbl.text = #text > 0 and text or nil
if len > 0 then
tbl.text = net.ReadData(len - 1)
end
tbl.font = net.ReadString()
tbl.size = net.ReadUInt(8)
tbl.valign = net.ReadUInt(2)
Expand Down

0 comments on commit 2f5a890

Please sign in to comment.