diff options
author | Jędrzej Nowacki <jedrzej.nowacki@nokia.com> | 2012-03-06 13:34:30 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-08 16:03:52 +0100 |
commit | f71487da3a93ec5f52af496301d91e5b8777494d (patch) | |
tree | a0b66a2cf96a2de4f4f14cc804fa28135e1058cf /src | |
parent | 779b3188a96ef1043ff8091ebe90e44750e1fa3b (diff) |
Fix crash in QVariant::canConvert.
The function was crashing when an unsupported type id was given
as an input argument.
Change-Id: I2b0e3e6d43f6f248dc71532f8e6485efe68e8120
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 029a261faf..c8456192ed 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2445,6 +2445,8 @@ bool QVariant::canConvert(int targetTypeId) const if (currentType == uint(targetTypeId)) return true; + if (targetTypeId < 0 || targetTypeId >= QMetaType::User) + return false; // FIXME It should be LastCoreType intead of Uuid if (currentType > int(QMetaType::QUuid) || targetTypeId > int(QMetaType::QUuid)) { |