From 9a3a3b641a11022a69d77840714da13d8c5c4d5e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 5 Jun 2014 23:23:07 +0200 Subject: [PATCH] Don't try to draw if there are no points in the path In some cases, for instance if drawEllipse() was called with a null QRect then it would still try to draw a QVectorPath without having enough points in the list. Therefore the point_count should be checked first before doing any drawing. Change-Id: I9b8dbb87c73b74e9df9eb10ec790a484d05d4c46 Reviewed-by: Gunnar Sletta --- src/gui/painting/qpaintengineex.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index e75a59cc91..8487cf2394 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -830,6 +830,8 @@ void QPaintEngineEx::drawEllipse(const QRectF &r) int point_count = 0; x.points[0] = qt_curves_for_arc(r, 0, -360, x.points + 1, &point_count); + if (point_count == 0) + return; QVectorPath vp((qreal *) pts, point_count + 1, qpaintengineex_ellipse_types, QVectorPath::EllipseHint); draw(vp); }