Access Violation error raised when comparing method to nil.

Issue #215 resolved
Alex Bespalov created an issue

Script:

program test;

type TSomeCallback = procedure( x, y: Integer );

procedure CBmethod( x, y:Integer );
begin 
  if( x <> 1000 ) and ( y >= 20 ) then
    x := 1000;              
  AddToSystemJournal(x,' ',y);
end;

function Methodwithcalback( x, y:Integer; callback:TSomeCallback ):Boolean;
begin
  if callback <> nil then 
  begin
    callback(x,y);
  end;
end;

begin
  Methodwithcalback(50,100,CBmethod); 
end.

If change line 14 to

if Assigned(callback) then

then it works fine, because thats correct way. But anyway, even on maximum it should throw script error, not Access Violation.

Comments (1)

  1. Log in to comment