Possible issue in GetIsDateTime method

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
GenasysCarl
Posts: 11
Joined: Mon Jan 09, 2017 6:15 am

Possible issue in GetIsDateTime method

Post 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;
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Possible issue in GetIsDateTime method

Post by larsa »

Hello

This is fixed in update 6.00.11
Lars Arvidsson, Axolot Data
Post Reply