diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-05-03 14:42:20 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-05-03 14:42:20 +0200 |
| commit | 9681d88cd3d801f56456bdbe91fe437ebcda96cb (patch) | |
| tree | 430da7f00ded8ef13f221e46bc357fff49dfcfca /src/check_expr.cpp | |
| parent | 30c6fea9e9dfb9be1efff6ce4e6954ae138d06bf (diff) | |
Fix #5107
Fixes #5107 by checking whether `result_count` is non-zero before indexing `type->Proc.results->Tuple.variables`.
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 69f6bb855..6f585fe73 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -8143,7 +8143,7 @@ gb_internal ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *c type = pt; } type = base_type(type); - if (type->kind == Type_Proc && type->Proc.optional_ok) { + if (type->kind == Type_Proc && type->Proc.optional_ok && type->Proc.result_count > 0) { operand->mode = Addressing_OptionalOk; operand->type = type->Proc.results->Tuple.variables[0]->type; if (operand->expr != nullptr && operand->expr->kind == Ast_CallExpr) { |