diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 06dbdbde181..a2e28b2d22d 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -855,8 +855,12 @@ static const struct : QMetaTypeModuleHelper { Q_ASSERT(fromTypeId != toTypeId); + // canConvert calls with two nullptr bool onlyCheck = (from == nullptr && to == nullptr); + // other callers must provide two valid pointers + Q_ASSERT(onlyCheck || (bool(from) && bool(to))); + using Char = char; using SChar = signed char; using UChar = unsigned char; @@ -2157,12 +2161,18 @@ static bool convertQObject(QMetaType fromType, const void *from, QMetaType toTyp Converts the object at \a from from \a fromTypeId to the preallocated space at \a to typed \a toTypeId. Returns \c true, if the conversion succeeded, otherwise false. + + Both \a from and \a to have to be valid pointers. + \since 5.2 */ /*! Converts the object at \a from from \a fromType to the preallocated space at \a to typed \a toType. Returns \c true, if the conversion succeeded, otherwise false. + + Both \a from and \a to have to be valid pointers. + \since 5.2 */ bool QMetaType::convert(QMetaType fromType, const void *from, QMetaType toType, void *to)