From 77a0de016ed8afc60a3d8b961b65b94b37d87036 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 29 Apr 2009 14:41:52 +0200 Subject: Fix a crash in case of setting invalid point size Asserts are replaced with warnings and the call is ignored. Task-number: 252414, 252416, 252502 Reviewed-by: Simon Hausmann --- src/gui/text/qfont.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 43f5b1e..24ff10b 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -890,7 +890,10 @@ int QFont::pointSize() const */ void QFont::setPointSize(int pointSize) { - Q_ASSERT_X (pointSize > 0, "QFont::setPointSize", "point size must be greater than 0"); + if (pointSize <= 0) { + qWarning("QFont::setPointSize: Point size <= 0 (%d), must be greater than 0", pointSize); + return; + } detach(); @@ -909,7 +912,10 @@ void QFont::setPointSize(int pointSize) */ void QFont::setPointSizeF(qreal pointSize) { - Q_ASSERT_X(pointSize > 0.0, "QFont::setPointSizeF", "point size must be greater than 0"); + if (pointSize <= 0) { + qWarning("QFont::setPointSizeF: Point size <= 0 (%d), must be greater than 0", pointSize); + return; + } detach(); -- cgit v0.12