diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-05-11 16:51:23 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-05-11 22:00:09 +0200 |
commit | 6d87f9a526e29da83e307d0e1ffe3b5bdb262091 (patch) | |
tree | 5b5dd05f6038d2aad3116045d91b1a722c91ee49 /src/gui/painting | |
parent | bdaaf99228f9d7385ec18ca7cc741535017e0033 (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/gui/painting')
-rw-r--r-- | src/gui/painting/qpaintengineex.cpp | 2 |
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); |