Skip to content

Commit d3636b0

Browse files
committed
Check original x/y finiteness in valid_x? and valid_y? before scaling
1 parent 1406e06 commit d3636b0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/unicode_plot/canvas.cr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ module UnicodePlot
8989
end
9090

9191
def valid_y?(y : Float64) : Bool
92+
return false unless y.finite?
9293
sy = @yscale.call(y)
9394
sy.finite? && @origin_y <= sy <= @origin_y + @height
9495
end
9596

9697
def valid_x?(x : Float64) : Bool
98+
return false unless x.finite?
9799
sx = @xscale.call(x)
98100
sx.finite? && @origin_x <= sx <= @origin_x + @width
99101
end

0 commit comments

Comments
 (0)