Browse Source

imageconverter: split error handling for file opening and image loading.

pull/449/head
Vladimír Vondruš 6 years ago
parent
commit
5c954a22be
  1. 9
      src/Magnum/Trade/imageconverter.cpp

9
src/Magnum/Trade/imageconverter.cpp

@ -263,10 +263,15 @@ key=true; configuration subgroups are delimited with /.)")
} }
/* Open input file and the desired image */ /* Open input file and the desired image */
if(!importer->openFile(args.value("input")) || !(image = importer->image2D(args.value<UnsignedInt>("image"), args.value<UnsignedInt>("level")))) { if(!importer->openFile(args.value("input"))) {
Error() << "Cannot open file" << args.value("input"); Error() << "Cannot open file" << args.value("input");
return 3; return 3;
} }
if(!(image = importer->image2D(args.value<UnsignedInt>("image"), args.value<UnsignedInt>("level")))) {
Error() << "Cannot import the image";
return 4;
}
} }
{ {
@ -304,6 +309,6 @@ key=true; configuration subgroups are delimited with /.)")
/* Save output file */ /* Save output file */
if(!converter->exportToFile(*image, args.value("output"))) { if(!converter->exportToFile(*image, args.value("output"))) {
Error() << "Cannot save file" << args.value("output"); Error() << "Cannot save file" << args.value("output");
return 4; return 5;
} }
} }

Loading…
Cancel
Save