From 3935c58febdf9b74a2dfb2562094332c1693ba80 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Mon, 10 May 2021 22:51:43 +0100 Subject: [PATCH] Catch TleException in Satellite Selection Dialog to avoid crash --- .../satelliteselectiondialog.cpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/plugins/feature/satellitetracker/satelliteselectiondialog.cpp b/plugins/feature/satellitetracker/satelliteselectiondialog.cpp index eb61a8f59..a86f377c4 100644 --- a/plugins/feature/satellitetracker/satelliteselectiondialog.cpp +++ b/plugins/feature/satellitetracker/satelliteselectiondialog.cpp @@ -224,14 +224,21 @@ void SatelliteSelectionDialog::displaySatInfo(const QString& name) } if (sat->m_tle != nullptr) { - info.append("Orbit:"); - Tle tle = Tle(sat->m_tle->m_tle0.toStdString(), - sat->m_tle->m_tle1.toStdString(), - sat->m_tle->m_tle2.toStdString()); - OrbitalElements ele(tle); - info.append(QString(" Period: %1 mins").arg(ele.Period())); - info.append(QString(" Inclination: %1%2").arg(Units::radiansToDegrees(ele.Inclination())).arg(QChar(0xb0))); - info.append(QString(" Eccentricity: %1").arg(ele.Eccentricity())); + try + { + info.append("Orbit:"); + Tle tle = Tle(sat->m_tle->m_tle0.toStdString(), + sat->m_tle->m_tle1.toStdString(), + sat->m_tle->m_tle2.toStdString()); + OrbitalElements ele(tle); + info.append(QString(" Period: %1 mins").arg(ele.Period())); + info.append(QString(" Inclination: %1%2").arg(Units::radiansToDegrees(ele.Inclination())).arg(QChar(0xb0))); + info.append(QString(" Eccentricity: %1").arg(ele.Eccentricity())); + } + catch (TleException tlee) + { + qDebug() << "SatelliteSelectionDialog::displaySatInfo: TleException " << tlee.what(); + } } ui->satInfo->setText(info.join("\n"));