Skip to content

Commit

Permalink
Fix #3: do not query Exif when it does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
xupefei committed May 2, 2017
1 parent 6901b10 commit 4e1b710
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal static ExifOrientation GetOrientationFromExif(string path)
var decoder = BitmapDecoder.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.None);
var frame = decoder.Frames[0];

var orientation = ((BitmapMetadata) frame.Metadata).GetQuery(@"/app1/{ushort=0}/{ushort=274}");
var orientation = ((BitmapMetadata) frame.Metadata)?.GetQuery(@"/app1/{ushort=0}/{ushort=274}");

if (orientation == null)
return ExifOrientation.Horizontal;
Expand Down

0 comments on commit 4e1b710

Please sign in to comment.