Handle empty Generate Image mode (#2598)
This commit is contained in:
parent
0e50d32ec5
commit
bd4c59cf34
@ -74,6 +74,10 @@ class GenerateImage extends Operation {
|
|||||||
Bits: 1 / 8,
|
Bits: 1 / 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!Object.hasOwn(bytePerPixelMap, mode)) {
|
||||||
|
throw new OperationError(`Unsupported Mode: (${mode})`);
|
||||||
|
}
|
||||||
|
|
||||||
const bytesPerPixel = bytePerPixelMap[mode];
|
const bytesPerPixel = bytePerPixelMap[mode];
|
||||||
|
|
||||||
if (bytesPerPixel > 0 && input.length % bytesPerPixel !== 0) {
|
if (bytesPerPixel > 0 && input.length % bytesPerPixel !== 0) {
|
||||||
|
|||||||
@ -45,6 +45,17 @@ TestRegister.addTests([
|
|||||||
{ op: "Render Image", args: ["Base64"] }
|
{ op: "Render Image", args: ["Base64"] }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Generate Image: empty mode",
|
||||||
|
input: "",
|
||||||
|
expectedOutput: "Unsupported Mode: ()",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "Generate Image",
|
||||||
|
args: ["", 8, 64]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Extract EXIF: nothing",
|
name: "Extract EXIF: nothing",
|
||||||
input: "",
|
input: "",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user