LL024
Exit without Result assignment
Object Pascal — Delphi & Free Pascal
Warning
Reliability
Calling Exit in a function without setting Result can return undefined values
calling Exit in a function without setting Result can return undefined values.
Why this severity
calling Exit in a function without setting Result can return undefined values.
Known false positives
functions where Result is assigned earlier in a single code path before Exit.
Remediation example
function GetValue: Integer;
begin
if Error then
begin
Result := -1;
Exit;
end;
Result := 42;
end;