Skip to content

Commit

Permalink
Update SetError
Browse files Browse the repository at this point in the history
  • Loading branch information
dnjulek committed Aug 2, 2023
1 parent 1196ae3 commit 3a4cc3a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/chromanr.zig
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,18 @@ export fn chromanrCreate(in: ?*const c.VSMap, out: ?*c.VSMap, userData: ?*anyopa
return;
}

if (d.stepw > d.sizew) {
vsapi.?.mapSetError.?(out, "chromanr: \"stepw\" cannot be bigger than \"sizew\"");
vsapi.?.freeNode.?(d.node);
return;
}

if (d.steph > d.sizeh) {
vsapi.?.mapSetError.?(out, "chromanr: \"steph\" cannot be bigger than \"sizeh\"");
vsapi.?.freeNode.?(d.node);
return;
}

var data: *ChromanrData = allocator.create(ChromanrData) catch unreachable;
data.* = d;

Expand Down

0 comments on commit 3a4cc3a

Please sign in to comment.