summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-05-11 16:51:23 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-05-11 22:00:09 +0200
commit6d87f9a526e29da83e307d0e1ffe3b5bdb262091 (patch)
tree5b5dd05f6038d2aad3116045d91b1a722c91ee49 /src
parentbdaaf99228f9d7385ec18ca7cc741535017e0033 (diff)
Tell code-checker drawPolygon can't be called with negative count
Change-Id: I082ab823ca039d1d611bfdab6b69e3650d724844 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qpaintengineex.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index d752c01f6a..2997d53310 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -938,6 +938,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount)
void QPaintEngineEx::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
{
+ Q_ASSUME(pointCount >= 2);
QVectorPath path((const qreal *) points, pointCount, nullptr, QVectorPath::polygonFlags(mode));
if (mode == PolylineMode)
@@ -948,6 +949,7 @@ void QPaintEngineEx::drawPolygon(const QPointF *points, int pointCount, PolygonD
void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
{
+ Q_ASSUME(pointCount >= 2);
int count = pointCount<<1;
QVarLengthArray<qreal> pts(count);