ICU-12572 Fixing undefined behavior in NullableValue assignment operator.

X-SVN-Rev: 41318
This commit is contained in:
Shane Carr 2018-05-03 09:26:15 +00:00
parent f1e1a5c3f4
commit 23bacf40c8

View File

@ -246,7 +246,13 @@ class U_I18N_API NullableValue {
fNull = false;
}
NullableValue<T>& operator=(const NullableValue<T>& other) = default;
NullableValue<T>& operator=(const NullableValue<T>& other) {
fNull = other.fNull;
if (!fNull) {
fValue = other.fValue;
}
return *this;
}
NullableValue<T>& operator=(const T& other) {
fValue = other;