From 308ccfc5922d91166915890c24443226084016c1 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Mon, 19 Feb 2018 13:02:05 -0600 Subject: [PATCH] Fix crash when moving task to end of list --- .../astrid/gtasks/OrderedMetadataListFragmentHelper.java | 2 +- .../astrid/subtasks/AstridOrderedListFragmentHelper.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/googleplay/java/com/todoroo/astrid/gtasks/OrderedMetadataListFragmentHelper.java b/app/src/googleplay/java/com/todoroo/astrid/gtasks/OrderedMetadataListFragmentHelper.java index 0628808dc..0fd76b0bc 100644 --- a/app/src/googleplay/java/com/todoroo/astrid/gtasks/OrderedMetadataListFragmentHelper.java +++ b/app/src/googleplay/java/com/todoroo/astrid/gtasks/OrderedMetadataListFragmentHelper.java @@ -85,12 +85,12 @@ class OrderedMetadataListFragmentHelper { if (targetTaskId <= 0) { return; // This can happen with gestures on empty parts of the list (e.g. extra space below tasks) } - long destinationTaskId = taskAdapter.getTaskId(to); try { if(to >= taskAdapter.getCount()) { updater.moveTo(list, targetTaskId, -1); } else { + long destinationTaskId = taskAdapter.getTaskId(to); updater.moveTo(list, targetTaskId, destinationTaskId); } } catch (Exception e) { diff --git a/app/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java b/app/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java index 3ebd1e568..70e5addbf 100644 --- a/app/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java +++ b/app/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java @@ -77,12 +77,12 @@ class AstridOrderedListFragmentHelper { if (!Task.isValidUuid(targetTaskId)) { return; // This can happen with gestures on empty parts of the list (e.g. extra space below tasks) } - String destinationTaskId = taskAdapter.getItemUuid(to); try { if(to >= taskAdapter.getCount()) { updater.moveTo(list, fragment.getFilter(), targetTaskId, "-1"); //$NON-NLS-1$ } else { + String destinationTaskId = taskAdapter.getItemUuid(to); updater.moveTo(list, fragment.getFilter(), targetTaskId, destinationTaskId); } } catch (Exception e) {