summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/serialport/terminal/mainwindow.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/serialport/terminal/mainwindow.cpp b/examples/serialport/terminal/mainwindow.cpp
index f9967cc..2cb52a1 100644
--- a/examples/serialport/terminal/mainwindow.cpp
+++ b/examples/serialport/terminal/mainwindow.cpp
@@ -109,7 +109,8 @@ void MainWindow::openSerialPort()
//! [5]
void MainWindow::closeSerialPort()
{
- serial->close();
+ if (serial->isOpen())
+ serial->close();
console->setEnabled(false);
ui->actionConnect->setEnabled(true);
ui->actionDisconnect->setEnabled(false);