Page 1 of 1

Possible issue in GetIsDateTime method

Posted: Thu Mar 30, 2017 12:16 pm
by GenasysCarl
Hi Lars,

A developer on my team asked if I can post the following possible issue he found. He tried to register an account for this forum, but says registration is not working?

We found an issue when calling the following method in XLSSheetData5.pas :

Code: Select all

function TXLSWorksheet.GetIsDateTime(ACol, ARow: integer): boolean;
There is n guard clause that tries to find a specific Cell and check its Celltype for validity.

Code: Select all

if (FCells.FindCell(ACol,ARow,Cell) and (FCells.CellType(@Cell) = xctBlank)) then
    Exit;

In our scenario the Cell is found, the CellType is xctString, but the Data property is Nil.
Thus, when the next line of code is executed, we get an Access Violation.

I have modified the guard clause to include a Nil check for that property (see below), and all seems to be working correct.

Code: Select all

if (FCells.FindCell(ACol,ARow,Cell) and (FCells.CellType(@Cell) = xctBlank)) or (Cell.Data = nil) then
    Exit;

Re: Possible issue in GetIsDateTime method

Posted: Mon Apr 03, 2017 1:38 pm
by larsa
Hello

This is fixed in update 6.00.11