{
/* find format arg */
unsigned idx = 0;
- for (; idx < spec->fmt_idx; ++idx)
+ for (; idx < spec->fmt_idx && arg != NULL; ++idx)
arg = arg->next;
+ if (arg == NULL)
+ return;
+
const expression_t *fmt_expr = arg->expression;
if (fmt_expr->kind == EXPR_UNARY_CAST_IMPLICIT) {
fmt_expr = fmt_expr->unary.value;
return;
}
/* find the real args */
- for(; idx < spec->arg_idx; ++idx)
+ for(; idx < spec->arg_idx && arg != NULL; ++idx)
arg = arg->next;
const source_position_t *pos = &fmt_expr->base.source_position;