From 2b56bc11eba9ae94da8800300ebec138a4b3f926 Mon Sep 17 00:00:00 2001 From: Tim Su Date: Tue, 28 Feb 2012 21:43:45 -0800 Subject: [PATCH] Fix for force close when you have an orphaned top-level child --- .../com/todoroo/astrid/subtasks/OrderedListUpdater.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedListUpdater.java b/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedListUpdater.java index 06ebd0516..29f18bd57 100644 --- a/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedListUpdater.java +++ b/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedListUpdater.java @@ -268,10 +268,13 @@ abstract public class OrderedListUpdater { parent.children.add(currentNode.get()); } else { // in a different tree Node node = currentNode.get().parent; - for(int i = indent; i < previousIndentValue; i++) + for(int i = indent; i < previousIndentValue; i++) { node = node.parent; - if(node == null) - node = root; + if(node == null) { + node = root; + break; + } + } currentNode.set(new Node(taskId, node)); node.children.add(currentNode.get()); }