summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2022-07-07 01:07:38 +0200
committerSlávek Banko <slavek.banko@axis.cz>2022-07-07 16:53:17 +0200
commitdfe0af7d336a92d6b858398d191d0cb0ec2be8bd (patch)
treeb205f26c7a877e159b6bfd5c7c8b66934441c7da
parente1ae8a61adef948789a260bbed7242cb53034a5c (diff)
downloadbasket-dfe0af7d336a92d6b858398d191d0cb0ec2be8bd.tar.gz
basket-dfe0af7d336a92d6b858398d191d0cb0ec2be8bd.zip
Fix crash on moving or coping the note while the selection is empty.
This resolves issue #11. Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 7c7f7a8147ede240eb7ce3352270fbba4a789986)
-rw-r--r--src/basket.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basket.cpp b/src/basket.cpp
index 67107d2..34cf750 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;