Handle empty Generate Image mode (#2598)

This commit is contained in:
Kirill
2026-06-25 11:59:33 +00:00
committed by GitHub
parent 0e50d32ec5
commit bd4c59cf34
2 changed files with 15 additions and 0 deletions
+4
View File
@@ -74,6 +74,10 @@ class GenerateImage extends Operation {
Bits: 1 / 8,
};
if (!Object.hasOwn(bytePerPixelMap, mode)) {
throw new OperationError(`Unsupported Mode: (${mode})`);
}
const bytesPerPixel = bytePerPixelMap[mode];
if (bytesPerPixel > 0 && input.length % bytesPerPixel !== 0) {