rbutil: Fix a crash for devices without bootloader file.

Don't try to get a bootloader filename from an empty list. This happens
if the device doesn't have a bootloader file on disk.

Change-Id: Idd4c265e7ae298913c5feefb3963120867a0e858
This commit is contained in:
Dominik Riebeling 2022-03-08 22:25:48 +01:00
parent 911b216aff
commit 3cebc983a2

View file

@ -116,6 +116,7 @@ void BootloaderInstallBase::progressAborted(void)
bool BootloaderInstallBase::backup(QString to)
{
LOG_INFO() << "Backing up bootloader file";
if(!m_blfile.isEmpty()) {
QDir targetDir(".");
emit logItem(tr("Creating backup of original firmware file."), LOGINFO);
if(!targetDir.mkpath(to)) {
@ -129,6 +130,10 @@ bool BootloaderInstallBase::backup(QString to)
return false;
}
emit logItem(tr("Backup created."), LOGOK);
}
else {
LOG_INFO() << "Bootloader backup not supported for current device.";
}
return true;
}
@ -215,9 +220,6 @@ void BootloaderInstallBase::setBlFile(QStringList sl)
m_blfile = sl.at(a);
}
}
if(m_blfile.isEmpty()) {
m_blfile = sl.at(0);
}
}