From 148b04e2d41d5c37c046e9a40529bbce334de7c4 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Thu, 17 Dec 2020 12:46:26 +0100 Subject: [PATCH] Try to prevent inner exception at the end of TMySQLQuery.Col. Hopefully reveals a more meaningful error message for issue #904 --- source/dbconnection.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/dbconnection.pas b/source/dbconnection.pas index c7bc8db0..3d3b80ad 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -7428,7 +7428,10 @@ end; function TDBQuery.ColumnCount: Integer; begin - Result := ColumnNames.Count; + if Assigned(FColumnNames) then + Result := FColumnNames.Count + else + Result := -1; end;