Bad RTF table causing RichView to error

General TRichView support forum. Please post your questions here
Post Reply
jgkoehn
Posts: 314
Joined: Thu Feb 20, 2020 9:32 pm

Bad RTF table causing RichView to error

Post by jgkoehn »

Greetings Sergey,

I am getting an error in this code:
First chance exception at $75D50144. Exception class EListError with message 'List index out of bounds (-1). TRVList is empty'.
I know it is bad RTF code on a Table (however, I can't always fix the bad RTF tables. These can be from users. Is there a way to handle this more robustly?)

Current code in RV22.2

Code: Select all

function TRVRTFReader.DoTable(WhatHappens: TRVRTFTableEventKind): Boolean;
begin
  Result := True;
  UpdateMarker;
  if Assigned(FOnTable) then
    FOnTable(Self, WhatHappens, Result);
  AfterTableRow := WhatHappens in [rvf_tbl_RowEnd, rvf_tbl_TableEnd,
    rvf_tbl_TableForcedEnd];
end;
Ideas?
Sergey Tkachenko
Site Admin
Posts: 17865
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Bad RTF table causing RichView to error

Post by Sergey Tkachenko »

This exception happens in try..except block, and finally LoadRTF function simply returns False.
The exception is not noticeable unless debugging in Delhi IDE.
jgkoehn
Posts: 314
Joined: Thu Feb 20, 2020 9:32 pm

Re: Bad RTF table causing RichView to error

Post by jgkoehn »

Is this related Sergey?
It is showing up in the Richview interface but not always.
Attachments
Screenshot 2025-07-13 072233.png
Screenshot 2025-07-13 072233.png (30.67 KiB) Viewed 1173 times
jgkoehn
Posts: 314
Joined: Thu Feb 20, 2020 9:32 pm

Re: Bad RTF table causing RichView to error

Post by jgkoehn »

It is highly possible I've done something wrong and just have no idea on how to get to the bottom of it.
Sergey Tkachenko
Site Admin
Posts: 17865
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Bad RTF table causing RichView to error

Post by Sergey Tkachenko »

If the error text is shown on TRichView itself, this mean that an exception happens while drawing content.
Most probably. it happens because TRichView is not formatted.
Do not forget to call Format after loading.
Post Reply