From 70363e50e803c5fedf77011a9bc0552e79f97d76 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 13 May 2021 23:13:48 +0100 Subject: [PATCH] Set pty serial port to NULL by default --- pttyhandler.cpp | 2 +- pttyhandler.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pttyhandler.cpp b/pttyhandler.cpp index 29a7153..d709de1 100644 --- a/pttyhandler.cpp +++ b/pttyhandler.cpp @@ -240,7 +240,7 @@ void pttyHandler::receiveDataIn(int fd) { void pttyHandler::closePort() { #ifdef Q_OS_WIN - if (port) + if (port != Q_NULLPTR) { port->close(); delete port; diff --git a/pttyhandler.h b/pttyhandler.h index 1081ebe..c066df2 100644 --- a/pttyhandler.h +++ b/pttyhandler.h @@ -53,7 +53,7 @@ private: unsigned char buffer[256]; QString portName; - QSerialPort* port; + QSerialPort* port = Q_NULLPTR; qint32 baudRate; unsigned char stopBits; bool rolledBack;