David PHAM-VAN

Fix exif orientation crash

@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 - Add curved LineDataSet Chart 6 - Add curved LineDataSet Chart
7 - Fix PdfColors.fromHex() 7 - Fix PdfColors.fromHex()
8 - Update Barcode library to 1.9.0 8 - Update Barcode library to 1.9.0
  9 +- Fix exif orientation crash
9 10
10 ## 1.7.1 11 ## 1.7.1
11 12
@@ -96,10 +96,17 @@ class PdfJpegInfo { @@ -96,10 +96,17 @@ class PdfJpegInfo {
96 ? null 96 ? null
97 : utf8.decode(tags[PdfExifTag.FlashpixVersion]); 97 : utf8.decode(tags[PdfExifTag.FlashpixVersion]);
98 98
99 - PdfImageOrientation get orientation =>  
100 - tags == null || tags[PdfExifTag.Orientation] == null  
101 - ? PdfImageOrientation.topLeft  
102 - : PdfImageOrientation.values[tags[PdfExifTag.Orientation] - 1]; 99 + PdfImageOrientation get orientation {
  100 + if (tags == null || tags[PdfExifTag.Orientation] == null) {
  101 + return PdfImageOrientation.topLeft;
  102 + }
  103 +
  104 + try {
  105 + return PdfImageOrientation.values[tags[PdfExifTag.Orientation] - 1];
  106 + } on RangeError {
  107 + return PdfImageOrientation.topLeft;
  108 + }
  109 + }
103 110
104 double get xResolution => tags == null || tags[PdfExifTag.XResolution] == null 111 double get xResolution => tags == null || tags[PdfExifTag.XResolution] == null
105 ? null 112 ? null