From 4346e969c20d76d979757a036c7ae138c85e3354 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 22 Aug 2014 18:36:07 -0700 Subject: [PATCH] Handle load failure correctly --- .../QGCPX4SensorCalibration.cc | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/ui/px4_configuration/QGCPX4SensorCalibration.cc b/src/ui/px4_configuration/QGCPX4SensorCalibration.cc index a17174f39..770f01c5d 100644 --- a/src/ui/px4_configuration/QGCPX4SensorCalibration.cc +++ b/src/ui/px4_configuration/QGCPX4SensorCalibration.cc @@ -280,22 +280,26 @@ void QGCPX4SensorCalibration::setGpsOrientation(int index) void QGCPX4SensorCalibration::setAutopilotImage(const QString &path) { - autopilotIcon.load(path); + if (autopilotIcon.load(path)) { + int w = ui->autopilotLabel->width(); + int h = ui->autopilotLabel->height(); - int w = ui->autopilotLabel->width(); - int h = ui->autopilotLabel->height(); - - ui->autopilotLabel->setPixmap(autopilotIcon.scaled(w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + ui->autopilotLabel->setPixmap(autopilotIcon.scaled(w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + } else { + qDebug() << "AutoPilot Icon image did not load" << path; + } } void QGCPX4SensorCalibration::setGpsImage(const QString &path) { - gpsIcon.load(path); + if (gpsIcon.load(path)) { + int w = ui->gpsLabel->width(); + int h = ui->gpsLabel->height(); - int w = ui->gpsLabel->width(); - int h = ui->gpsLabel->height(); - - ui->gpsLabel->setPixmap(gpsIcon.scaled(w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + ui->gpsLabel->setPixmap(gpsIcon.scaled(w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + } else { + qDebug() << "GPS Icon image did not load" << path; + } } void QGCPX4SensorCalibration::updateIcons() -- 2.22.0