Expression illegal in evaluator (& Access Violation)

前端 未结 2 374
情话喂你
情话喂你 2021-01-29 13:25

Im trying to process a plain text file (loaded into a StringList), by using class Tbb2uc but getting AV at calling function GetAddress.

  TArrayQuotePositions =          


        
2条回答
  •  迷失自我
    2021-01-29 13:43

    It was a static array that i was over-indexing. The debugger cannot pinpoint the exact line so it was not obvious (for me):

    function Tbb2uc.GetQuotePositions( aLine: string ): TArrayQuotePositions;
    var
      i: integer;
      arraypos: integer;
    begin
      for i := low(TArrayQuotePositions) to high(TArrayQuotePositions) do begin
        Farrayquotes[i] := 0;
      end;
      arraypos := low(TArrayQuotePositions);
      for i := 1 to length(aLine) do begin
        if aLine[i] = CHAR_FOR_COLLECT then begin         
          Farrayquotes[arraypos] := i;  //over-indexing, Farrayquotes: TArrayQuotePositions = array[1..4] of integer;
          inc(arraypos);            
        end;
      end;
      result := Farrayquotes;
    end;
    

    Sorry... indeed my question was far from complete.

提交回复
热议问题