RichMemo.GetTextAttributes() does not return false when first param out of range
Original Reporter info from Mantis: dbannon @davidbannon
-
Reporter name: David
Original Reporter info from Mantis: dbannon @davidbannon
- Reporter name: David
Description:
First Param to this function points to a char in the Memo that it should report on. The function is described as returning False if the indicated char is somehow invalid. Passing -1 or a number greater than RichMemo.GetTexLen() however returns True.
Works fin under Linux.
Steps to reproduce:
if Richmemo1.GetTextAttributes(-1, FP) then showmessage('Failed on -1');
if Richmemo1.GetTextAttributes(30000, FP) then showmessage('Failed on 30000');
Additional information:
An easy fix appears to add a test at entry into the function, insert into line 677 of RichMemo.pas -
677 Result := False;
678 if (textStart < 0) or (TextStart >= GetTextLen) then exit();
Its unnecessary under linux but does no harm. I have tested under Win10 and GTK2 based Linux.
Mantis conversion info:
- Mantis ID: 32296
- OS Build: 10
- Platform: Windows
- Version: 1.8RC4
- Monitored by: » @davidbannon (David)