Fixed crashing if a message has no room for any entityevents (TODO: make sure item position updates don't take up all the space in the messages and prevent entityevents from being sent)

This commit is contained in:
Joonas Rikkonen
2017-06-28 18:38:24 +03:00
parent 5d5923ab28
commit b904cb8e0e
@@ -65,10 +65,13 @@ namespace Barotrauma.Networking
eventCount++; eventCount++;
} }
if (eventCount > 0)
{
msg.Write(eventsToSync[0].ID); msg.Write(eventsToSync[0].ID);
msg.Write((byte)eventCount); msg.Write((byte)eventCount);
msg.Write(tempBuffer); msg.Write(tempBuffer);
} }
}
protected virtual void WriteEvent(NetBuffer buffer, NetEntityEvent entityEvent, Client recipient = null) protected virtual void WriteEvent(NetBuffer buffer, NetEntityEvent entityEvent, Client recipient = null)
{ {