From b2ecff52106c3be6789925dc6b67950ea575fdc1 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Fri, 1 Nov 2019 12:37:10 +0100 Subject: [PATCH] Fix crash when trying to add a new grid row while a first one was not yet saved. Closes #788 --- source/main.pas | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/main.pas b/source/main.pas index d22e276d..70c8c1b6 100644 --- a/source/main.pas +++ b/source/main.pas @@ -9401,8 +9401,12 @@ begin Allowed := Results.SaveModifications; DisplayRowCountStats(Sender); end else if Results.Inserted then begin - Results.DiscardModifications; - Sender.DeleteNode(OldNode); + if NewNode <> nil then begin + Results.DiscardModifications; + Sender.DeleteNode(OldNode); + end else begin + Allowed := False; + end; end; end; end;