diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index 78ccac7aa058e627444af81655172a7b5e3aa23f..f18d4a221b5fac2d554d231461c38de5f3e59ca9 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -608,9 +608,11 @@ void QGCToolBar::connectLink(bool connect) if (link) { QString portname = portComboBox->currentText().split(":")[2]; - if (portname.indexOf('-') != -1) + if (portname.indexOf('-') >= 0) { - portname = portname.split("-")[0]; + //Take everything before the last -, this ensures if the com port has a - in it, it will be included, + //since the last - is inserted by me. + portname = portname.mid(0,portname.lastIndexOf("-")-1); } link->setPortName(portname.trimmed()); }