Add the type check in mrb_str_to_cstr().

Related on #989.