Skip to content

Commit 7af0466

Browse files
committed
Convert code path which should never happen to assertion
1 parent eae3bda commit 7af0466

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,10 @@ U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, getRuleStatusVec)
147147

148148
int32_t num_rules = fetch_rbbi(bio)->getRuleStatusVec(NULL, 0,
149149
BREAKITER_ERROR_CODE(bio));
150-
if (BREAKITER_ERROR_CODE(bio) == U_BUFFER_OVERFLOW_ERROR) {
151-
BREAKITER_ERROR_CODE(bio) = U_ZERO_ERROR;
152-
} else {
153-
// should not happen
154-
INTL_METHOD_CHECK_STATUS(bio, "rbbi_get_rule_status_vec: failed "
155-
" determining the number of status values");
156-
}
150+
151+
ZEND_ASSERT(BREAKITER_ERROR_CODE(bio) == U_BUFFER_OVERFLOW_ERROR);
152+
BREAKITER_ERROR_CODE(bio) = U_ZERO_ERROR;
153+
157154
int32_t *rules = new int32_t[num_rules];
158155
num_rules = fetch_rbbi(bio)->getRuleStatusVec(rules, num_rules,
159156
BREAKITER_ERROR_CODE(bio));

0 commit comments

Comments
 (0)