mirror of
https://github.com/lovell/sharp.git
synced 2026-02-04 05:36:18 +01:00
Fail fast when input Buffer is empty #37
This commit is contained in:
@@ -209,12 +209,12 @@ async.series([
|
||||
},
|
||||
// Rotate to an invalid angle, should fail
|
||||
function(done) {
|
||||
var isValid = false;
|
||||
var fail = false;
|
||||
try {
|
||||
sharp(inputJpg).rotate(1);
|
||||
isValid = true;
|
||||
fail = true;
|
||||
} catch (e) {}
|
||||
assert(!isValid);
|
||||
assert(!fail);
|
||||
done();
|
||||
},
|
||||
// Do not enlarge the output if the input width is already less than the output width
|
||||
@@ -252,6 +252,15 @@ async.series([
|
||||
}).catch(function(err) {
|
||||
throw err;
|
||||
});
|
||||
},
|
||||
// Empty Buffer, should fail
|
||||
function(done) {
|
||||
var fail = false;
|
||||
try {
|
||||
sharp(new Buffer(0));
|
||||
fail = true;
|
||||
} catch (e) {}
|
||||
assert(!fail);
|
||||
done();
|
||||
}
|
||||
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user