ICU-21387 measunit: check for nullptr before calling delete
diff --git a/icu4c/source/i18n/measunit.cpp b/icu4c/source/i18n/measunit.cpp
index dab3abb..c3e39b9 100644
--- a/icu4c/source/i18n/measunit.cpp
+++ b/icu4c/source/i18n/measunit.cpp
@@ -2105,7 +2105,9 @@
     if (this == &other) {
         return *this;
     }
-    delete fImpl;
+    if (fImpl != nullptr) {
+        delete fImpl;
+    }
     if (other.fImpl) {
         ErrorCode localStatus;
         fImpl = new MeasureUnitImpl(other.fImpl->copy(localStatus));
@@ -2126,7 +2128,9 @@
     if (this == &other) {
         return *this;
     }
-    delete fImpl;
+    if (fImpl != nullptr) {
+        delete fImpl;
+    }
     fImpl = other.fImpl;
     other.fImpl = nullptr;
     fTypeId = other.fTypeId;
@@ -2139,8 +2143,10 @@
 }
 
 MeasureUnit::~MeasureUnit() {
-    delete fImpl;
-    fImpl = nullptr;
+    if (fImpl != nullptr) {
+        delete fImpl;
+        fImpl = nullptr;
+    }
 }
 
 const char *MeasureUnit::getType() const {
@@ -2298,8 +2304,10 @@
 void MeasureUnit::setTo(int32_t typeId, int32_t subTypeId) {
     fTypeId = typeId;
     fSubTypeId = subTypeId;
-    delete fImpl;
-    fImpl = nullptr;
+    if (fImpl != nullptr) {
+        delete fImpl;
+        fImpl = nullptr;
+    }
 }
 
 int32_t MeasureUnit::getOffset() const {