summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/i18n/measure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'deps/icu-small/source/i18n/measure.cpp')
-rw-r--r--deps/icu-small/source/i18n/measure.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/deps/icu-small/source/i18n/measure.cpp b/deps/icu-small/source/i18n/measure.cpp
index bffa44215e..23adba1007 100644
--- a/deps/icu-small/source/i18n/measure.cpp
+++ b/deps/icu-small/source/i18n/measure.cpp
@@ -23,7 +23,7 @@ U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Measure)
-Measure::Measure() {}
+Measure::Measure() : unit(nullptr) {}
Measure::Measure(const Formattable& _number, MeasureUnit* adoptedUnit,
UErrorCode& ec) :
@@ -35,7 +35,7 @@ Measure::Measure(const Formattable& _number, MeasureUnit* adoptedUnit,
}
Measure::Measure(const Measure& other) :
- UObject(other), unit(0) {
+ UObject(other), unit(nullptr) {
*this = other;
}
@@ -43,7 +43,11 @@ Measure& Measure::operator=(const Measure& other) {
if (this != &other) {
delete unit;
number = other.number;
- unit = other.unit->clone();
+ if (other.unit != nullptr) {
+ unit = other.unit->clone();
+ } else {
+ unit = nullptr;
+ }
}
return *this;
}