Assert that either both or neither pointer are nullptr

Identical change to qmetatype.cpp

Fixes static analyzer warning 0267bc9b3ba521cf8bf0a7fea8981ee5

Change-Id: Id6219f5025d703dd43b1742a067aa934d6aacd8c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 3be3848338040f4178ed5a450d98eed883b79cb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2021-02-24 13:10:33 +01:00 committed by Qt Cherry-pick Bot
parent 5be74d220a
commit 100881d886

View File

@ -117,6 +117,8 @@ static const struct : QMetaTypeModuleHelper
Q_ASSERT(fromTypeId != toTypeId);
bool onlyCheck = (from == nullptr && to == nullptr);
// either two nullptrs from canConvert, or two valid pointers
Q_ASSERT(onlyCheck || (bool(from) && bool(to)));
using Int = int;
switch (makePair(toTypeId, fromTypeId)) {