diff --git a/src/app/tools/point_shape.cpp b/src/app/tools/point_shape.cpp index ce55e7e4a..12b727a6d 100644 --- a/src/app/tools/point_shape.cpp +++ b/src/app/tools/point_shape.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2020 Igara Studio S.A. +// Copyright (C) 2020-2021 Igara Studio S.A. // Copyright (C) 2001-2015 David Capello // // This program is distributed under the terms of @@ -81,11 +81,11 @@ void PointShape::doInkHline(int x1, int y, int x2, ToolLoop* loop) } // Clipped in X axis else { - x1 = base::clamp(x1, 0, dstw-1); - x2 = base::clamp(x2, 0, dstw-1); - if (x2-x1+1 < 1) + if (x2 < 0 || x1 >= dstw || x2-x1+1 < 1) return; + x1 = base::clamp(x1, 0, dstw-1); + x2 = base::clamp(x2, 0, dstw-1); ink->inkHline(x1, y, x2, loop); } }