Delete tmpfile on all failures

This commit is contained in:
Anton Thomasson 2021-02-24 21:50:28 +01:00
parent 86b580c15f
commit d6ef26b64e

View file

@ -93,6 +93,7 @@ void ConvertWorker::convertPdf(QNetworkRequest request, QString filename, QTempo
} }
else else
{ {
tempfile->deleteLater();
emit failed(tr("Unsupported target format")); emit failed(tr("Unsupported target format"));
return; return;
} }
@ -344,6 +345,7 @@ void ConvertWorker::convertImage(QNetworkRequest request, QString filename, QTem
} }
else else
{ {
tempfile->deleteLater();
emit failed(tr("Unsupported target format")); emit failed(tr("Unsupported target format"));
return; return;
} }
@ -373,6 +375,7 @@ void ConvertWorker::convertImage(QNetworkRequest request, QString filename, QTem
if(!inImage.load(filename)) if(!inImage.load(filename))
{ {
qDebug() << "failed to load"; qDebug() << "failed to load";
tempfile->deleteLater();
emit failed(tr("Failed to load image")); emit failed(tr("Failed to load image"));
return; return;
} }