AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Strange AV

Ein Thema von WojTec · begonnen am 14. Dez 2013 · letzter Beitrag vom 15. Dez 2013
Antwort Antwort
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#1

Strange AV

  Alt 14. Dez 2013, 19:35
Delphi-Version: XE5
Delphi-Quellcode:
procedure TForm1.ListView1Resize(Sender: TObject);
var
  I: Integer;
  FileName: string;
begin
  for I := 0 to ListView1.Items.Count do
  begin
    FileName := ListView1.Items[I].SubItems[4];
    FileName := MinimizeName(FileName, ListView1.Canvas, ListView1.Column[5].Width);
    ListView1.Items[I].SubItems[4] := FileName
  end;
end;
There is 7 columns. Why this raises AV
  Mit Zitat antworten Zitat
Medium

Registriert seit: 23. Jan 2008
3.686 Beiträge
 
Delphi 2007 Enterprise
 
#2

AW: Strange AV

  Alt 14. Dez 2013, 19:38
Because .Count gives you the count. Not the highest index. That would generally be Count-1, in zero based arrays and lists.
(I would be interested in how many threads here deal with this infamous off-by-one issue )
"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins)
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#3

Re: Strange AV

  Alt 14. Dez 2013, 19:56
Oh my gosh! I totally did not notice it! What the completely stupid error
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.184 Beiträge
 
Delphi 12 Athens
 
#4

AW: Strange AV

  Alt 14. Dez 2013, 21:01
The title of your posts I would call "bad".

And your description of the error is even worse.
- Neither the error occurs
- Yet what it is for an error

Yes, the messages can be copied from the error messages by pressing Ctrl + C.

And no, the message is not "strange". She even tells you exactly as you did wrong.


Zitat:
List index out of bounds (%d)
$2B or not $2B
  Mit Zitat antworten Zitat
Medium

Registriert seit: 23. Jan 2008
3.686 Beiträge
 
Delphi 2007 Enterprise
 
#5

AW: Re: Strange AV

  Alt 15. Dez 2013, 03:39
Oh my gosh! I totally did not notice it! What the completely stupid error
Rest assured: It wasn't the last time Those will follow us into our graves, I fear. The only "stupid" thing was to post it here, and expose us all to the fact, that even renowned programmers, as many of us are, aren't impregnable to the most basic faults available
"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:32 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz