mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #5305 from dearblue/symbol0
Check first `0` when converting symbols into strings
This commit is contained in:
+3
-1
@@ -303,6 +303,7 @@ mrb_check_intern_str(mrb_state *mrb, mrb_value str)
|
||||
static const char*
|
||||
sym2name_len(mrb_state *mrb, mrb_sym sym, char *buf, mrb_int *lenp)
|
||||
{
|
||||
if (sym == 0) goto outofsym;
|
||||
if (SYMBOL_INLINE_P(sym)) return sym_inline_unpack(sym, buf, lenp);
|
||||
|
||||
#ifndef MRB_NO_PRESYM
|
||||
@@ -313,7 +314,8 @@ sym2name_len(mrb_state *mrb, mrb_sym sym, char *buf, mrb_int *lenp)
|
||||
#endif
|
||||
sym -= MRB_PRESYM_MAX;
|
||||
|
||||
if (sym == 0 || mrb->symidx < sym) {
|
||||
if (mrb->symidx < sym) {
|
||||
outofsym:
|
||||
if (lenp) *lenp = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user