From 988ad8b45ad1b0afff7f5bef12df8d3c978837eb Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sat, 3 Oct 2009 15:13:29 +0200 Subject: Finally found the bug that caused Topic text to be garbled. Signed-off-by: Graeme Geldenhuys --- src/HelpTopic.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/HelpTopic.pas b/src/HelpTopic.pas index c0f72ffc..1d64c147 100644 --- a/src/HelpTopic.pas +++ b/src/HelpTopic.pas @@ -222,10 +222,11 @@ begin if SlotNumber < FileHeader.nslots then begin pSlotOffsets := FileData + FileHeader.slotsstart; - + // point to correct slot offset pSlotData := pSlotHeader( FileData + pSlotOffsets^[ SlotNumber ] ); - - Slot.pData := pInt8( pSlotData + sizeof( TSlotHeader ) ); + if pSlotData^.stuff <> Byte(0) then + raise Exception.Create('We are NOT at the correct location in the file for the SlotHeader structure!'); + Slot.pData := pInt8(pSlotData) + sizeof(TSlotHeader); Slot.pLocalDictionary := FileData + pSlotData^.localDictPos; Slot.LocalDictSize := pSlotData^.nLocalDict; Slot.Size := pSlotData^.ntext; -- cgit v1.2.3-70-g09d2