]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/uregex.cpp
ICU-66108.tar.gz
[apple/icu.git] / icuSources / i18n / uregex.cpp
index 57c2febe9d02bcb7f52e368897be6cd369886d7a..7f41918cff93a458f220ecf7d1332b35f61aa79a 100644 (file)
@@ -1508,7 +1508,8 @@ int32_t RegexCImpl::appendReplacement(RegularExpression    *regexp,
                         (c32 >= 0x31 && c32 <= 0x39)) {       // 0..9
                     groupName.append(c32);
                 } else if (c32 == RIGHTBRACKET) {
-                    groupNum = uhash_geti(regexp->fPat->fNamedCaptureMap, &groupName);
+                    groupNum = regexp->fPat->fNamedCaptureMap ?
+                            uhash_geti(regexp->fPat->fNamedCaptureMap, &groupName) : 0;
                     if (groupNum == 0) {
                         // Name not defined by pattern.
                         *status = U_REGEX_INVALID_CAPTURE_GROUP_NAME;