Skip to content

Commit 2e72d13

Browse files
committed
Return early for invalid orientation values.
1 parent 6176138 commit 2e72d13

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

js/load-image-orientation.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,18 @@ Exif orientation values to correctly display the letter F:
111111
)
112112
}
113113

114-
// Transform image orientation based on
115-
// the given EXIF orientation option:
114+
// Transform image orientation based on the given EXIF orientation option:
116115
loadImage.transformCoordinates = function (canvas, options) {
117116
originalTransformCoordinates.call(loadImage, canvas, options)
117+
var orientation = options.orientation
118+
if (!(orientation > 1 && orientation < 9)) {
119+
return
120+
}
118121
var ctx = canvas.getContext('2d')
119122
var width = canvas.width
120123
var height = canvas.height
121124
var styleWidth = canvas.style.width
122125
var styleHeight = canvas.style.height
123-
var orientation = options.orientation
124-
if (!(orientation > 1 && orientation < 9)) {
125-
return
126-
}
127126
if (orientation > 4) {
128127
canvas.width = height
129128
canvas.height = width

0 commit comments

Comments
 (0)