mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 08:30:49 +00:00
- fixed: The return checking code must be inside the nullptr check for item.code.
This commit is contained in:
parent
0851d698de
commit
0f9ebff3ee
1 changed files with 8 additions and 7 deletions
|
@ -715,6 +715,13 @@ void FFunctionBuildList::Build()
|
||||||
|
|
||||||
FScriptPosition::StrictErrors = !item.FromDecorate;
|
FScriptPosition::StrictErrors = !item.FromDecorate;
|
||||||
item.Code = item.Code->Resolve(ctx);
|
item.Code = item.Code->Resolve(ctx);
|
||||||
|
item.Proto = ctx.ReturnProto;
|
||||||
|
|
||||||
|
// Make sure resolving it didn't obliterate it.
|
||||||
|
if (item.Code != nullptr)
|
||||||
|
{
|
||||||
|
assert(item.Proto != nullptr);
|
||||||
|
|
||||||
if (!item.Code->CheckReturn())
|
if (!item.Code->CheckReturn())
|
||||||
{
|
{
|
||||||
auto newcmpd = new FxCompoundStatement(item.Code->ScriptPosition);
|
auto newcmpd = new FxCompoundStatement(item.Code->ScriptPosition);
|
||||||
|
@ -722,12 +729,6 @@ void FFunctionBuildList::Build()
|
||||||
newcmpd->Add(new FxReturnStatement(nullptr, item.Code->ScriptPosition));
|
newcmpd->Add(new FxReturnStatement(nullptr, item.Code->ScriptPosition));
|
||||||
item.Code = newcmpd->Resolve(ctx);
|
item.Code = newcmpd->Resolve(ctx);
|
||||||
}
|
}
|
||||||
item.Proto = ctx.ReturnProto;
|
|
||||||
|
|
||||||
// Make sure resolving it didn't obliterate it.
|
|
||||||
if (item.Code != nullptr)
|
|
||||||
{
|
|
||||||
assert(item.Proto != nullptr);
|
|
||||||
|
|
||||||
// Generate prototype for anonymous functions.
|
// Generate prototype for anonymous functions.
|
||||||
VMScriptFunction *sfunc = item.Function;
|
VMScriptFunction *sfunc = item.Function;
|
||||||
|
|
Loading…
Reference in a new issue