Bad entity in IndexOfEdict() index?

Causes my game to completely close down. Happens when I walk out of an entity.
function ENT:EndTouch( Entity )

if !Entity:IsPlayer() then
if self.SetUpSuccess == false then
local rp = RecipientFilter()

if !self.Data then return end
umsg.Start( "SendPlayerPortalInfo", rp)
	umsg.String( Entity:Nick() )
	umsg.String( self.Data["SubCat"] )
	umsg.String( self.Data["Server"] )
	umsg.String( self.Data["Cat"] )
	umsg.String( self.Data["IP"] )


All of my table values are valid strings too. I just did a test. Seems to be the user message that’s doing it.

Here’s what’s going on clientside:
usermessage.Hook(“SendPlayerPortalInfo”, function(um)

local ply = um:ReadString()
local subcat = um:ReadString()
local server = um:ReadString()
local cat = um:ReadString()
local ip = um:ReadString()

local c_ply = Color( 255, 0, 0 )
local c_words = Color( 255, 255, 255 )
local c_subcat = Color( 230, 230, 0 )
local c_server = Color( 50, 50, 255 )
local c_cat = Color( 230, 230, 150 )
local c_ip = Color( 150, 230, 150 )

chat.AddText( c_ply, ply, c_words, " has gone to the ", c_server, server, c_words, " server via the ", c_subcat, subcat.." ", c_cat, cat, c_words, " portal! ", c_ip, "IP: "..ip, c_words, ".")


:question: What in the fuck is going on here? :question:

I won’t pretend I have a clue but does it happen when you just walk out of it or when you do try a connection?

Read. It says when I walk out.

I take it you’ve tried commenting out the usermessage and then it works? In that case, comment out everything again and uncomment just the vital parts, like just Start and End. Don’t send anything. Make a simple print on the client if it got the usermessage or not. If that works, start by uncommenting a string, print it on the client, repeat until you get the error message and you will know what causes it.

Oh and something else, nothing important, but you could optimize that code a little :V