From 5a7cf3eeeb208c2dac52541cb09b519b4342a5ff Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Wed, 3 Sep 2014 07:53:15 -0700 Subject: Fix TransitionManager.go() to allow null transitions The doc'd behavior of go() is that a null transition is equivalent to just switching to a scene with no transition. The actual behavior was an NPE crash. Issue #17342291 TransitionManager.go() with null Transition parameter throws NPE unlike documentation Change-Id: I9416aa6e307f80eefc201ca3264fd64f8587ac2f --- core/java/android/transition/TransitionManager.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'core/java/android/transition') diff --git a/core/java/android/transition/TransitionManager.java b/core/java/android/transition/TransitionManager.java index ce3cc2f..7bd6287 100644 --- a/core/java/android/transition/TransitionManager.java +++ b/core/java/android/transition/TransitionManager.java @@ -182,11 +182,15 @@ public class TransitionManager { final ViewGroup sceneRoot = scene.getSceneRoot(); - Transition transitionClone = transition.clone(); - transitionClone.setSceneRoot(sceneRoot); + Transition transitionClone = null; + if (transition != null) { + transitionClone = transition.clone(); + transitionClone.setSceneRoot(sceneRoot); + } Scene oldScene = Scene.getCurrentScene(sceneRoot); - if (oldScene != null && oldScene.isCreatedFromLayoutResource()) { + if (oldScene != null && transitionClone != null && + oldScene.isCreatedFromLayoutResource()) { transitionClone.setCanRemoveViews(true); } -- cgit v1.1