diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-08-19 23:39:52 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2022-08-20 10:06:40 +0900 |
commit | 43e8d9a0509e1961c406fedb2c168a6ec2359fdc (patch) | |
tree | 92b80966d8056eb463a8be265b6e1ca9b0e11eff /string.c | |
parent | d2483393cbcb4dcfa0000fa8166bb7fa7ed9f7b4 (diff) |
Check if encoding capable object before check if ASCII compatible
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6260
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -2526,6 +2526,9 @@ void rb_must_asciicompat(VALUE str) { rb_encoding *enc = rb_enc_get(str); + if (!enc) { + rb_raise(rb_eTypeError, "not encoding capable object"); + } if (!rb_enc_asciicompat(enc)) { rb_raise(rb_eEncCompatError, "ASCII incompatible encoding: %s", rb_enc_name(enc)); } |