Always return initialized data from QBindable::value

clang warned about result being uninitialized if iface is nullptr. Return
a properly initialized result in that case as well.

This might break RVO, but the alternative is to always initialize result,
even if we are going to call the getter anyway, which I assume would be
more expensive.

Change-Id: I5d6d243b3094b79bf021725d017be5c72b1089bb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-10-28 09:59:31 +01:00
parent bcd2f3f99e
commit 979c8cf1b7

View File

@ -651,10 +651,12 @@ public:
T value() const
{
T result;
if (iface)
if (iface) {
T result;
iface->getter(data, &result);
return result;
return result;
}
return T{};
}
void setValue(const T &value)