Permalink
Browse files

Fix crash: Remove attempt to copy non existent image data from previe…

…w panel. Closes #422.
  • Loading branch information...
ansgarbecker committed Dec 4, 2018
1 parent 9d61fb5 commit 2f2e21b30042239437be259cd9db343c78625581
Showing with 6 additions and 5 deletions.
  1. +6 −5 source/main.pas
@@ -9195,7 +9195,6 @@ procedure TMainForm.AnyGridBeforeCellPaint(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
var
VT: TVirtualStringTree;
r: TDBQuery;
cl, clNull, clEven, clOdd, clSameData: TColor;
RowNumber: PInt64;
@@ -9204,7 +9203,7 @@ procedure TMainForm.AnyGridBeforeCellPaint(Sender: TBaseVirtualTree;
begin
if Column = -1 then
Exit;
VT := Sender as TVirtualStringTree;
r := GridResult(Sender);
if not r.Connection.Active then begin
// This event (BeforeCellPaint) is the very first one to notice a broken connection
@@ -9792,9 +9791,11 @@ procedure TMainForm.actCopyOrCutExecute(Sender: TObject);
Screen.Cursor := crHourglass;
try
if SendingControl = btnPreviewCopy then begin
imgPreview.Picture.SaveToClipBoardFormat(ClpFormat, ClpData, APalette);
ClipBoard.SetAsHandle(ClpFormat, ClpData);
Success := True;
if (imgPreview.Picture.Graphic <> nil) and (not imgPreview.Picture.Graphic.Empty) then begin
imgPreview.Picture.SaveToClipBoardFormat(ClpFormat, ClpData, APalette);
ClipBoard.SetAsHandle(ClpFormat, ClpData);
Success := True;
end;
end else if Control is TCustomEdit then begin
Edit := TCustomEdit(Control);
if Edit.SelLength > 0 then begin

0 comments on commit 2f2e21b

Please sign in to comment.