title: List index out of bounds error when printing QR report
body: <p>I get errors like "List index out of bounds" when sending a QuickReport report to the selected printer as the Printer.Printers stringlist is accessed.</p>
  
  <pre><code>exception class   : EStringListError
  exception message : List index out of bounds (6).
  
  main thread ($1594c):
  00479559 skdata.exe   Classes   5060 TStringList.GetObject
  004a258b skdata.exe   Printers   581 TPrinter.GetPrinter
  007ca744 skdata.exe   QRPrntr   3208 TPrinterSettings.ApplySettings
  007cb5bb skdata.exe   QRPrntr   3995 TQRPrinter.BeginDoc
  007be227 skdata.exe   QuickRpt  4645 TCustomQuickRep.CreateReport
  007be909 skdata.exe   QuickRpt  4853 TCustomQuickRep.Print
  00859bc7 skdata.exe   PostLst    142 TPostSpecListReport.Print
  </code></pre>
  
  <p>I've added logging that shows that the list of printers (Printer.Printers) has changed just before the error happened. I guess the list of printers can change if a network printer is switched off, if the network is down, and for other reasons too.</p>
  
  <p>How to handle this situation? In Delphi the selected printer is given by the Printer.PrinterIndex, but if the list of printers is changed, then this index is not valid anymore. </p>
  
  <p>I can only think of one solution which is to present the select-printer dialog before every print, in other words not to rely in Printer.PrinterIndex being correct from one print job to the next. But that could be quite annoying to the user.</p>
  
  <p>Ideally the selected printer should be stored as a GUID or by name. That would make it more reliable.</p>
  
  <p>I've searched this forum as well as the Embarcadero forum but haven't found any mention of this kind of problem. So maybe there's something simple here that I've overlooked?</p>
  
  <p>I use Delphi 2007 and QuickReport 5.</p>