summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/i18n/uregex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'deps/icu-small/source/i18n/uregex.cpp')
-rw-r--r--deps/icu-small/source/i18n/uregex.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/deps/icu-small/source/i18n/uregex.cpp b/deps/icu-small/source/i18n/uregex.cpp
index a5dee6241d..3703843634 100644
--- a/deps/icu-small/source/i18n/uregex.cpp
+++ b/deps/icu-small/source/i18n/uregex.cpp
@@ -1465,8 +1465,10 @@ int32_t RegexCImpl::appendReplacement(RegularExpression *regexp,
int32_t groupNum = 0;
U_ASSERT(c == DOLLARSIGN);
- UChar32 c32;
- U16_GET(replacementText, 0, replIdx, replacementLength, c32);
+ UChar32 c32 = -1;
+ if (replIdx < replacementLength) {
+ U16_GET(replacementText, 0, replIdx, replacementLength, c32);
+ }
if (u_isdigit(c32)) {
int32_t numDigits = 0;
int32_t numCaptureGroups = m->fPattern->fGroupMap->size();