Skip to content

Commit

Permalink
Merge pull request #370 from jmlich/bips-crash
Browse files Browse the repository at this point in the history
Avoid crash if firmware info is null
  • Loading branch information
piggz authored May 12, 2024
2 parents 62460cc + ef05b2f commit 8198238
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions daemon/src/deviceinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,10 @@ QString DeviceInterface::prepareFirmwareDownload(const QString &path)
return QString();
}
m_firmwareInfo = m_device->firmwareInfo(file.readAll());
if (m_firmwareInfo == nullptr) {
qWarning() << "m_firmwareInfo is NULL";
return QString();
}
if (m_firmwareInfo->type() != AbstractFirmwareInfo::Invalid) {
m_device->prepareFirmwareDownload(m_firmwareInfo);
return m_firmwareInfo->version();
Expand All @@ -760,6 +764,11 @@ bool DeviceInterface::startDownload()
qDebug() << Q_FUNC_INFO;
auto config = AmazfishConfig::instance();

if (m_firmwareInfo == nullptr) {
qWarning() << "m_firmwareInfo is NULL";
return false;
}

if (m_firmwareInfo->supportedOnDevice(m_device->deviceName()) || config->appOverrideFwCheck()) {
m_device->startDownload();
return true;
Expand Down

0 comments on commit 8198238

Please sign in to comment.