adding type check to lookup-type

This commit is contained in:
Alex Shinn 2013-01-19 01:30:49 +09:00
parent ec21e90e16
commit 7d3d700300

4
sexp.c
View file

@ -332,7 +332,9 @@ sexp sexp_register_simple_type_op (sexp ctx, sexp self, sexp_sint_t n, sexp name
sexp sexp_lookup_type_op(sexp ctx, sexp self, sexp_sint_t n, sexp name, sexp id) {
int i;
sexp res;
const char* str = sexp_string_data(name);
const char* str;
sexp_assert_type(ctx, sexp_stringp, SEXP_STRING, name);
str = sexp_string_data(name);
if (sexp_fixnump(id)) {
i = sexp_unbox_fixnum(id);
if (i < sexp_context_num_types(ctx)