diff options
author | stefan-niedermann <info@niedermann.it> | 2019-05-06 12:45:51 +0300 |
---|---|---|
committer | stefan-niedermann <info@niedermann.it> | 2019-05-06 12:45:51 +0300 |
commit | b69e6eeafe10e1b8187f73876e9bf2b6854c9e55 (patch) | |
tree | 9005a9e9131125b6adc7bb43070930688e06f773 /app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java | |
parent | e39ec4fd62225600ef5588d4d7f4ea9c9ab6f1a8 (diff) |
Fix crash on drag 'n' drop
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java index 2cf030917..af1b13655 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java @@ -56,10 +56,13 @@ public class CrossTabDragAndDrop { } } - int viewUnderPosition = owner.getChildAdapterPosition(Objects.requireNonNull(owner.findChildViewUnder(dragEvent.getX(), dragEvent.getY()))); - if(viewUnderPosition != -1) { - DeckLog.log(dragEvent.getAction() + " moved something..."); - Objects.requireNonNull(cardAdapter).moveItem(owner.getChildLayoutPosition(view), viewUnderPosition); + View viewUnder = owner.findChildViewUnder(dragEvent.getX(), dragEvent.getY()); + if(viewUnder != null) { + int viewUnderPosition = owner.getChildAdapterPosition(viewUnder); + if (viewUnderPosition != -1) { + DeckLog.log(dragEvent.getAction() + " moved something..."); + Objects.requireNonNull(cardAdapter).moveItem(owner.getChildLayoutPosition(view), viewUnderPosition); + } } break; case DragEvent.ACTION_DROP: |