Skip to content

Commit

Permalink
Fix segfault when gradual-checking with no arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mwh committed Jul 4, 2012
1 parent 953fa0b commit b269f5c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gracelib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2354,6 +2354,8 @@ int checkmethodcall(Method *m, int nparts, int *argcv, Object *argv) {
int i, j;
int k = 0;
struct MethodType *t = m->type;
if (t == NULL || nparts == 0 || argcv == NULL || argv == NULL)
return 1;
int partcv[] = {1};
for (i = 0; i < nparts, i < t->nparts; i++) {
for (j = 0; j < argcv[i] && j < t->argcv[i]; j++) {
Expand Down Expand Up @@ -2407,7 +2409,7 @@ Object callmethod3(Object self, const char *name,
if (calldepth == STACK_SIZE) {
die("Maximum call stack depth exceeded.");
}
if (m != NULL && m->type != NULL) {
if (m != NULL && m->type != NULL && partc && argcv && argv) {
if (!checkmethodcall(m, partc, argcv, argv))
die("Type error.");
}
Expand Down

0 comments on commit b269f5c

Please sign in to comment.