Commit 77a30e94 authored by Adam Reichold's avatar Adam Reichold Committed by Albert Astals Cid

pdfdetach: Check for valid embedded file before trying to save it.

Closes #661
parent 6912e06d
Pipeline #7741 passed with stage
in 11 minutes and 46 seconds
......@@ -251,7 +251,12 @@ int main(int argc, char *argv[]) {
}
*p = '\0';
if (!fileSpec->getEmbeddedFile()->save(path)) {
auto *embFile = fileSpec->getEmbeddedFile();
if (!embFile || !embFile->isOk()) {
exitCode = 3;
goto err2;
}
if (!embFile->save(path)) {
error(errIO, -1, "Error saving embedded file as '{0:s}'", p);
exitCode = 2;
goto err2;
......@@ -296,7 +301,12 @@ int main(int argc, char *argv[]) {
p = path;
}
if (!fileSpec->getEmbeddedFile()->save(p)) {
auto *embFile = fileSpec->getEmbeddedFile();
if (!embFile || !embFile->isOk()) {
exitCode = 3;
goto err2;
}
if (!embFile->save(p)) {
error(errIO, -1, "Error saving embedded file as '{0:s}'", p);
exitCode = 2;
goto err2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment