Fix variant getters not setting return type
The validated getters were only setting the value without changing the type, leading to wrong results. This uses the same path used for methods to the same purpose.
This commit is contained in:
parent
48049b8d9e
commit
8a9e3524a9
3 changed files with 37 additions and 24 deletions
|
|
@ -1128,4 +1128,26 @@ struct VariantTypeChanger {
|
|||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct VariantTypeAdjust {
|
||||
_FORCE_INLINE_ static void adjust(Variant *r_ret) {
|
||||
VariantTypeChanger<typename GetSimpleTypeT<T>::type_t>::change(r_ret);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct VariantTypeAdjust<Variant> {
|
||||
_FORCE_INLINE_ static void adjust(Variant *r_ret) {
|
||||
// Do nothing for variant.
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct VariantTypeAdjust<Object *> {
|
||||
_FORCE_INLINE_ static void adjust(Variant *r_ret) {
|
||||
VariantInternal::clear(r_ret);
|
||||
*r_ret = (Object *)nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // VARIANT_INTERNAL_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue