diff --git a/modules/juce_graphics/geometry/juce_Line.h b/modules/juce_graphics/geometry/juce_Line.h index ad258e5fa9..b938d07728 100644 --- a/modules/juce_graphics/geometry/juce_Line.h +++ b/modules/juce_graphics/geometry/juce_Line.h @@ -203,7 +203,8 @@ public: */ Point getPointAlongLine (ValueType distanceFromStart) const noexcept { - return start + (end - start) * (distanceFromStart / getLength()); + const auto length = getLength(); + return length == 0 ? start : start + (end - start) * (distanceFromStart / length); } /** Returns a point which is a certain distance along and to the side of this line.