diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java index 4d54e0be9..5d0ac2f2d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java @@ -329,9 +329,8 @@ public class StashApplyCommand extends GitCommand { private void resetUntracked(RevTree tree) throws CheckoutConflictException, IOException { - TreeWalk walk = null; + TreeWalk walk = new TreeWalk(repo); // maybe NameConflictTreeWalk; try { - walk = new TreeWalk(repo); // maybe NameConflictTreeWalk? walk.addTree(tree); walk.addTree(new FileTreeIterator(repo)); walk.setRecursive(true); @@ -362,8 +361,7 @@ public class StashApplyCommand extends GitCommand { checkoutPath(entry, reader); } } finally { - if (walk != null) - walk.release(); + walk.release(); } }