More careful about checking for null serial port
This commit is contained in:
parent
069fb3162d
commit
115693ea42
1 changed files with 5 additions and 2 deletions
|
|
@ -2117,8 +2117,11 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
CommunicationState = CommunicationStates.Disconnecting;
|
||||
ReadThreadHolder.Join();
|
||||
serialPort.Close();
|
||||
serialPort.Dispose();
|
||||
if (serialPort != null)
|
||||
{
|
||||
serialPort.Close();
|
||||
serialPort.Dispose();
|
||||
}
|
||||
serialPort = null;
|
||||
CommunicationState = CommunicationStates.Disconnected;
|
||||
LinesToWriteQueue.Clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue