fpspreadsheet: Prevent adding field defs for unsupported field types.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8099 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-09-28 17:17:40 +00:00
parent f7bb7a8c7a
commit db6dc4b039

View File

@ -509,6 +509,9 @@ function TsWorksheetDataset.AddFieldDef(
AName: String; ADataType: TFieldType; ASize: Integer = 0; AColIndex: Integer = -1;
ACodePage: TSystemCodePage = CP_UTF8): TsFieldDef;
begin
if not (ADataType in ftSupported) then
DatabaseError('Field type not supported.');
if AColIndex = -1 then
AColIndex := FieldDefs.Count;
Result := TsFieldDef.Create(TsFieldDefs(FieldDefs),