mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:34:42 +01:00
Avoid dereferencing a disengaged optional (#865)
This commit is contained in:
@@ -992,7 +992,9 @@ auto TypeChecker::TypeCheckFunDef(FunctionDefinition* f, TypeEnv types,
|
||||
&return_type_context);
|
||||
body_stmt = res.stmt;
|
||||
// Save the return type in case it changed.
|
||||
return_type = *return_type_context.deduced_return_type();
|
||||
if (return_type_context.deduced_return_type().has_value()) {
|
||||
return_type = *return_type_context.deduced_return_type();
|
||||
}
|
||||
}
|
||||
auto body = CheckOrEnsureReturn(body_stmt, f->is_omitted_return_type(),
|
||||
f->source_loc());
|
||||
|
||||
Reference in New Issue
Block a user