From 0eadb153b414eb3ca87d859488b289b90d64c208 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Tue, 9 Dec 2003 09:59:29 +0000 Subject: [PATCH] added assertions to get_method_param_type() and get_method_res_type() [r2205] --- ir/tr/type.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ir/tr/type.c b/ir/tr/type.c index 6f66c9b39..61b98b11c 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -910,9 +910,12 @@ int get_method_n_params (type *method) { return method->attr.ma.n_params; } type *get_method_param_type(type *method, int pos) { + type *res; assert(method && (method->type_op == type_method)); assert(pos >= 0 && pos < get_method_n_params(method)); - return method->attr.ma.param_type[pos] = skip_tid(method->attr.ma.param_type[pos]); + res = method->attr.ma.param_type[pos]; + assert(res != NULL && "empty method param type"); + return method->attr.ma.param_type[pos] = skip_tid(res); } void set_method_param_type(type *method, int pos, type* tp) { assert(method && (method->type_op == type_method)); @@ -950,9 +953,12 @@ int get_method_n_ress (type *method) { return method->attr.ma.n_res; } type *get_method_res_type(type *method, int pos) { + type *res; assert(method && (method->type_op == type_method)); assert(pos >= 0 && pos < get_method_n_ress(method)); - return method->attr.ma.res_type[pos] = skip_tid(method->attr.ma.res_type[pos]); + res = method->attr.ma.res_type[pos]; + assert(res != NULL && "empty method return type"); + return method->attr.ma.res_type[pos] = skip_tid(res); } void set_method_res_type(type *method, int pos, type* tp) { assert(method && (method->type_op == type_method)); -- 2.20.1