From 7c7f7a8147ede240eb7ce3352270fbba4a789986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 7 Jul 2022 01:07:38 +0200 Subject: [PATCH] Fix crash on moving or coping the note while the selection is empty. This resolves issue #11. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- src/basket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basket.cpp b/src/basket.cpp index 128c1cb..a767275 100644 --- a/src/basket.cpp +++ b/src/basket.cpp @@ -2415,7 +2415,7 @@ void Basket::contentsMouseMoveEvent(TQMouseEvent *event) m_isSelecting = false; // Don't draw selection rectangle ater drag! m_selectionStarted = false; NoteSelection *selection = selectedNotes(); - if (selection->firstStacked()) { + if (selection && selection->firstStacked()) { TQDragObject *d = NoteDrag::dragObject(selection, /*cutting=*/false, /*source=*/this); // d will be deleted by QT /*bool shouldRemove = */d->drag(); // delete selection; @@ -4204,7 +4204,7 @@ void Basket::doCopy(CopyMode copyMode) NoteSelection *selection = selectedNotes(); int countCopied = countSelecteds(); - if (selection->firstStacked()) { + if (selection && selection->firstStacked()) { TQDragObject *d = NoteDrag::dragObject(selection, copyMode == CutToClipboard, /*source=*/0); // d will be deleted by QT // /*bool shouldRemove = */d->drag(); // delete selection;