1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[server] Prevent exception from being thrown if a rogue LineComplete message is received

This commit is contained in:
Starbeamrainbowlabs 2017-04-16 16:00:49 +01:00
parent 405a5aad85
commit aa0852a3b2

View file

@ -365,6 +365,12 @@ namespace Nibriboard.Client
/// <param name="message">The message to handle.</param> /// <param name="message">The message to handle.</param>
protected async Task handleLineCompleteMessage(LineCompleteMessage message) protected async Task handleLineCompleteMessage(LineCompleteMessage message)
{ {
// If the line doesn't exist, then ignore it
if(!manager.LineIncubator.LineExists(message.LineId))
{
Log.WriteLine("[NibriClient/handlers] Ignoring LineComplete event for line that doesn't exist");
return;
}
DrawnLine line = manager.LineIncubator.CompleteLine(message.LineId); DrawnLine line = manager.LineIncubator.CompleteLine(message.LineId);
line.LineWidth = message.LineWidth; line.LineWidth = message.LineWidth;
line.Colour = message.LineColour; line.Colour = message.LineColour;