fix regression #14715 by adding an additional check for the newly build metadata object (#15198)

This commit is contained in:
CleanCodeDeveloper
2021-12-29 18:01:31 +01:00
committed by GitHub
parent b6affde530
commit d39c4121a9
2 changed files with 34 additions and 1 deletions

View File

@@ -104,7 +104,15 @@ namespace ImageResizer.Models
}
}
metadata = newMetadata;
if (newMetadata.IsMetadataObjectValid())
{
metadata = newMetadata;
}
else
{
// Seems like we build an invalid metadata object. ImageResizer will fail when trying to write the image to disk. We discard all metadata to be able to save the image.
metadata = null;
}
}
catch (ArgumentException ex)
{