Ensure invalid resize width/height as options throw #1817

This commit is contained in:
Lovell Fuller
2019-08-16 21:21:12 +01:00
parent da4e05c118
commit 69fe21a7ec
3 changed files with 27 additions and 4 deletions

View File

@@ -210,12 +210,20 @@ function resize (width, height, options) {
}
if (is.object(options)) {
// Width
if (is.integer(options.width) && options.width > 0) {
this.options.width = options.width;
if (is.defined(options.width)) {
if (is.integer(options.width) && options.width > 0) {
this.options.width = options.width;
} else {
throw is.invalidParameterError('width', 'positive integer', options.width);
}
}
// Height
if (is.integer(options.height) && options.height > 0) {
this.options.height = options.height;
if (is.defined(options.height)) {
if (is.integer(options.height) && options.height > 0) {
this.options.height = options.height;
} else {
throw is.invalidParameterError('height', 'positive integer', options.height);
}
}
// Fit
if (is.defined(options.fit)) {