2 # Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
4 Add NULL checks for TimeZone::createTimeZoneIDEnumeration calls
5 https://unicode-org.atlassian.net/browse/ICU-12377
7 --- icu/source/i18n/dtfmtsym.cpp.orig
8 +++ icu/source/i18n/dtfmtsym.cpp
10 do { // dummy do-while
12 tzids = TimeZone::createTimeZoneIDEnumeration(ZONE_SET, nullptr, nullptr, status);
13 + if (tzids == nullptr) {
14 + status = U_MEMORY_ALLOCATION_ERROR;
17 rows = tzids->count(status);
18 if (U_FAILURE(status)) {
20 --- icu/source/i18n/zonemeta.cpp.orig
21 +++ icu/source/i18n/zonemeta.cpp
23 u_UCharsToChars(region, regionBuf, 2);
25 StringEnumeration *ids = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL_LOCATION, regionBuf, nullptr, status);
26 - int32_t idsLen = ids->count(status);
27 - if (U_SUCCESS(status) && idsLen == 1) {
28 - // only the single zone is available for the region
30 + if (ids != nullptr) {
31 + int32_t idsLen = ids->count(status);
32 + if (U_SUCCESS(status) && idsLen == 1) {
33 + // only the single zone is available for the region
41 umtx_lock(&gZoneMetaLock);