Tell code-checker drawPolygon can't be called with negative count

Change-Id: I082ab823ca039d1d611bfdab6b69e3650d724844
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2021-05-11 16:51:23 +02:00
parent bdaaf99228
commit 6d87f9a526

View File

@ -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);