Skip to content

Commit

Permalink
Fix crash on disconnect when failed to connect
Browse files Browse the repository at this point in the history
Fix #67 and bug report by doranchak (post no 1084 on forum thread at
minecraft forums)
  • Loading branch information
ORelio committed Mar 2, 2015
1 parent 72c2ff5 commit e491603
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions MinecraftClient/McTcpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,11 @@ public void Disconnect()
if (bot is ChatBots.Script)
scripts_on_hold.Add((ChatBots.Script)bot);

handler.Disconnect();
handler.Dispose();
if (handler != null)
{
handler.Disconnect();
handler.Dispose();
}

if (cmdprompt != null)
cmdprompt.Abort();
Expand Down

0 comments on commit e491603

Please sign in to comment.