Jump to content
kvk1989

List index out of bounds(1)

Recommended Posts

Hi , 

I'm trying to get gpt partition in listview when i click button it's give me this error

 

My codes

 

procedure TForm1.sButton9Click(Sender: TObject);
var
  st1, st2, st3, st4: Int64;
  i: Integer;
  staradr, endadr, sizeadr: string;
  sList: TStringList;
  storage: string;
begin
  if (Firehose = '') then // (RawXML = '') or (PathXML = '') then
  begin
    Showmessage('Firehose Not Found Please add it');
    exit;
  end;
  if (not Pos('9008', cbb1.Text) > 0) then
  begin
    Showmessage('Port qualcomm not detected ');
    exit;
  end;
  Screen.Cursor := crHourGlass;
  Port := Getport(cbb1.Text).Trim;
  log('Scanning port ', 0, 0);
  log('Qualcomm HS-USB QDLoader 9008' + #13, 0, 1);
  log('Connect ', 0, 0);
  log(Trim(cbb1.Text) + #13, clTeal, 1);
  log('Initialize device ... ' + #13, 0, 0);
  if not(EmmcDlInfo(Port)) then
  begin
    log('Expection : DA already Send Please remove cable and try again ' + #13,
      clred, 1);
    Screen.Cursor := 0;
    exit;
  end;
  log('Serial ', 0, 0);
  log(info.serial + #13, 0, 1);
  log('MSM ID ', 0, 0);
  log(info.msmid + #13, 0, 1);
  log('PKHASH ', 0, 0);
  log(info.hash + #13, 0, 1);
  log('SBL ID ', 0, 0);
  log(info.sblid + #13, 0, 1);
  log('Initialize successfuly ' + #13, 0, 0);
  application.ProcessMessages;
  if (cbb2.ItemIndex = 0) then
    storage := 'emmc'
  else
    storage := 'ufs';
  log('Storage Type ', 0, 0);
  log(uppercase(storage) + #13, 0, 1);
  application.ProcessMessages;
  ListGPT := TStringList.Create;
  sList := TStringList.Create;
  try
    if not(EmmcDlGPT(Port, storage, Firehose)) then
      exit;

    if ListGPT.Count > 0 then
    begin
      application.ProcessMessages;
      for i := 0 to ListGPT.Count - 1 do
      begin
        splitkata(',', ListGPT, sList);
        st1 := (StrToint64(sList[1]) * 512);
        st2 := (StrToint64(sList[2]) * 512);
        st3 := ((st1 + st2) - 1);
         st4 := Trunc(StrToint64(sList[2]) / 2);
        staradr := '0x' + IntToHex(st1, 8);
        endadr := '0x' + IntToHex(st3, 8);
        sizeadr := intTostr(st4);
        application.ProcessMessages;
      ListViewXML(sList, sList + '.img', staradr, endadr, sizeadr, lv1);
      end;
    end;
    log('Information GPT operation successfuly' + #13, 0, 1);
  finally
    ListGPT.Free;
    sList.Free;
  end;
  application.ProcessMessages;
  log('Rebooting ... ', 0, 0);
  EmmcDlReboot(Port);
  Screen.Cursor := 0;
end;

 

Edited by kvk1989

Share this post


Link to post

sList[1] is likely the issue because sList contains 1 or fewer items. Use the debugger to confirm.

 

Those calls to ProcessMessages look likely to cause you problems. If.not now, some time in the future. 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×