Set expressionType to a default value when LoadAddress encounters an error.

This can occur in cases such as trying to assign to a non-l-value.

This patch ensures consistent handling of errors and prevents null pointer dereferences.
This commit is contained in:
Stephen Heumann 2019-12-23 20:34:54 -06:00
parent 91094e9292
commit cb063afa47

View File

@ -2405,9 +2405,11 @@ var
else if ExpressionKind(tree) in [arrayType,pointerType] then
GenerateCode(tree)
else
else begin
expressionType := wordPtr; {set default type in case of error}
if doDispose then {prevent spurious errors}
Error(78);
end; {else}
1:
end; {LoadAddress}