commit | 188ab856914ea76aa81bc55c6f3e4ad66566c66c | [log] [tgz] |
---|---|---|
author | Benjamin ROBIN <dev@benjarobin.fr> | Sun Jan 28 20:26:14 2024 +0100 |
committer | Yordan Karadzhov <y.karadz@gmail.com> | Sun Feb 04 19:17:25 2024 +0200 |
tree | 59e9fbd899d9d40999af101df91ce9075c003ca0 | |
parent | c373cc79178d740d80da68ef9defa36ff9a367c4 [diff] |
kernelshark: Prevent potential divide by zero in Shape::center() Signed-off-by: Benjamin ROBIN <dev@benjarobin.fr> Signed-off-by: Yordan Karadzhov <y.karadz@gmail.com>
diff --git a/src/KsPlotTools.cpp b/src/KsPlotTools.cpp index 1d63a9b..f362eaa 100644 --- a/src/KsPlotTools.cpp +++ b/src/KsPlotTools.cpp
@@ -318,6 +318,9 @@ { ksplot_point c = {0, 0}; + if (_nPoints == 0) + return c; + for (size_t i = 0; i < _nPoints; ++i) { c.x += _points[i].x; c.y += _points[i].y;