I have a function that takes an array of variant constructed at runtime, but
if the resultant array length is zero I get insurmountable problems.  A
simple example:

procedure Execute(A: array of variant);
begin
  ShowMessage('Exiting...');
  Exit;
  ShowMessage(A[0]); // This never runs, but ANY reference causes problems
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Execute([1]); // Works
  Execute([]); // Sometimes "invalid variant operation",
               // sometimes access violation in oleaut32.dll
               // (depending on what other code is around)
end;

Can anyone tell me why?

Cheers,
Carl
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to