#
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
#
Add NULL checks for TimeZone::createTimeZoneIDEnumeration calls
https://unicode-org.atlassian.net/browse/ICU-12377

--- icu/source/i18n/dtfmtsym.cpp.orig
+++ icu/source/i18n/dtfmtsym.cpp
@@ -1295,6 +1295,10 @@
     do { // dummy do-while
 
         tzids = TimeZone::createTimeZoneIDEnumeration(ZONE_SET, NULL, NULL, status);
+       if (tzids == NULL) {
+               status = U_MEMORY_ALLOCATION_ERROR;
+               break;
+       }
         rows = tzids->count(status);
         if (U_FAILURE(status)) {
             break;
--- icu/source/i18n/zonemeta.cpp.orig
+++ icu/source/i18n/zonemeta.cpp
@@ -456,12 +456,14 @@
             u_UCharsToChars(region, regionBuf, 2);
 
             StringEnumeration *ids = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL_LOCATION, regionBuf, NULL, status);
-            int32_t idsLen = ids->count(status);
-            if (U_SUCCESS(status) && idsLen == 1) {
-                // only the single zone is available for the region
-                singleZone = true;
-            }
-            delete ids;
+           if (ids != NULL) {
+               int32_t idsLen = ids->count(status);
+               if (U_SUCCESS(status) && idsLen == 1) {
+                       // only the single zone is available for the region
+                       singleZone = true;
+               }
+               delete ids;
+           }
 
             // Cache the result
             umtx_lock(&gZoneMetaLock);