aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/string.c b/string.c
index 28b1efa2e9..227424d266 100644
--- a/string.c
+++ b/string.c
@@ -2090,9 +2090,7 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
str_cr = RSTRING_LEN(str) ? ENC_CODERANGE(str) : ENC_CODERANGE_7BIT;
if (str_encindex == ptr_encindex) {
- if (str_cr == ENC_CODERANGE_UNKNOWN)
- ptr_cr = ENC_CODERANGE_UNKNOWN;
- else if (ptr_cr == ENC_CODERANGE_UNKNOWN) {
+ if (str_cr != ENC_CODERANGE_UNKNOWN && ptr_cr == ENC_CODERANGE_UNKNOWN) {
ptr_cr = coderange_scan(ptr, len, rb_enc_from_index(ptr_encindex));
}
}