ImageData: make sure that width and height are not 0

This commit is contained in:
Halil Durak
2026-02-17 02:18:43 +03:00
parent 3c01e24f02
commit cfa9427d7c

View File

@@ -58,6 +58,10 @@ pub fn constructor(
maybe_settings: ?ConstructorSettings,
page: *Page,
) !*ImageData {
if (width == 0 or height == 0) {
return error.IndexSizeError;
}
const settings: ConstructorSettings = maybe_settings orelse .{};
if (settings.colorSpace.eql(comptime .wrap("srgb")) == false) {
return error.TypeError;