Must set vaTerm.comm property to nil during tx

I have a simple bbs application where I am scripting the login / pw and uploading and downloading of files.

I am using the TVaZModem component to transfer the files.
 
Before I start the transfer the I set the comm property to nil so that the file contents are not displayed in ther terminal.  Is this necessary?  The reason I am asking is that if I set this to nil and I am using the TVaWaitMsg component then
I get a List Index Out of Bounds error as soon as I call TVaModem.Execute for both download and upload.

Sorry I meant to also include the error is ocurring in TVACustomComm.WriteBuffer;

If you do not set comm = nil in the TvaTerminal, the terminal will show the file data being received. 
It is unclear how you get the "List index out of bounds" exception. If a problem persists, please provide some sample source code so we can investigate this issue here.

This is the vaWaitMsg event:

The List index out of bounds (4) ocurrs as soon as vaZModem.Execute is executed.
procedure TfrmECNovitas.vaWaitMsgMessage(Sender: TObject; Index: Integer);
begin
  TermMsg('Index: '+IntToStr(Index));
  case Index of
    Prompt_Logon: begin
      vaWaitMsg.Active := False;
      FLastOperation := OPER_LOGON;
      vaWaitMsg.Active := True;
      TermMsg('Entering Login');
      vaComm.WriteText(GetFieldValue('ClaimLogin')+#13);
    end;
    Prompt_Password: begin
      vaWaitMsg.Active := False;
      FLastOperation := OPER_PASSWORD;
      vaWaitMsg.Active := True;
      TermMsg('Entering Password');
      vaComm.WriteText(GetFieldValue('ClaimPassword')+#13);
    end;
    Prompt_MainPrompt: begin
      vaWaitMsg.Active := False;
      case FLastOperation of
        OPER_PASSWORD: begin
          if ClaimsToSend(PTranRecArray) then begin
            FLastOperation := OPER_START_SEND;
            vaWaitMsg.Active := True;
            TermMsg('Press 1');
            vaComm.WriteText('1'+#13);
          end else begin
            FLastOperation := OPER_RECEIVE;
            vaWaitMsg.Active := True;
            TermMsg('Press 2');
            vaComm.WriteText('2'+#13);
          end;
        end;
        //After sending file
        OPER_CONTINUE: begin
          FLastOperation := OPER_RECEIVE;
          vaWaitMsg.Active := True;
          TermMsg('Press 2');
          vaComm.WriteText('2'+#13);
        end;
        OPER_RECEIVE, OPER_RECEIVING: begin
          FLastOperation := OPER_LOGOFF;
          TermMsg('Logging Off');
          vaComm.WriteText('LO'+#13);
        end;
      end;
    end;
    Prompt_Complete: begin
      vaWaitMsg.Active := False;
      case FLastOperation of
        OPER_SENDING: begin
          FLastOperation := OPER_CONTINUE;
          vaWaitMsg.Active := True;
          TermMsg('Entering to continue');
          vaComm.WriteText(#13);
        end;
      end;
    end;
    Prompt_StartTrans: begin
      vaWaitMsg.Active := False;
      case FLastOperation of
        OPER_RECEIVE,OPER_RECEIVING: begin
          FLastOperation := OPER_RECEIVING;
          vaTerminal.Comm := nil;
          vaZModem.Mode := tmDownLoad;
          //vaWaitMsg.Active := True;
          TermMsg('Starting to receive');
          try
            vaZModem.Execute();
          except
          end; 
        end;
        OPER_START_SEND: begin
          vaWaitMsg.Active := False;
          FLastOperation := OPER_SENDING;
          Sleep(1500); //Pause for 1.5 seconds
          vaTerminal.Comm := nil;
          vaZModem.Mode := tmUpload;
          vaZModem.Files.Add(PTranRecArray^[Low(PTranRecArray^)].ClaimFile);
          TermMsg('Starting Upload');
          try
            vaZModem.Execute();
          except
            //Eat exception
          end;
        end;
      end;
    end;
  end;

It is very difficult to guess from this code snippet what is exactly happening.
Can it be there is still data receiving when you set VaTerminal.Comm = nil?

You'd typically set this to nil before you send the command that the file data can be sent, so no data is received at the same time as you set VaTerminal.Comm = nil

The issue seemed to be with setting the comm property to nil inside of the TVaWaitMsg event.  Because the event had not completed it still beleived that the comm property was set and this caused an index out of bounds error.

We removed the set comm = nil to another method outside of the TVaWaitMsg event so that whatever process we were interupting could complete and not throw the index out of bounds error in VaProtocol.
 
const
  UWM_STARTZMODEMUPLOAD = WM_APP + 1;
procedure StartZModemUpload(var Msg: TMessage); message UWM_STARTZMODEMUPLOAD;
procedure TfrmECNovitas.StartZModemUpload(var Msg: TMessage);
begin
  Sleep(1500); //Pause for 1.5 seconds
  vaTerminal.Comm := nil;
  vaZModem.Mode := tmUpload;
  vaZModem.Files.Add(PTranRecArray^[Low(PTranRecArray^)].ClaimFile);
  TermMsg('Starting Upload');
  vaZModem.Execute();
end;

Thanks for informing