diff options
author | Chet Haase <chet@google.com> | 2014-09-03 07:53:15 -0700 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2014-09-03 07:53:15 -0700 |
commit | 5a7cf3eeeb208c2dac52541cb09b519b4342a5ff (patch) | |
tree | c3f701cebd9b40457098993819981d09416686a7 /core/java/android/transition | |
parent | d06cd2b1bd067e911d48c3b0c81a503c5772c98f (diff) | |
download | frameworks_base-5a7cf3eeeb208c2dac52541cb09b519b4342a5ff.zip frameworks_base-5a7cf3eeeb208c2dac52541cb09b519b4342a5ff.tar.gz frameworks_base-5a7cf3eeeb208c2dac52541cb09b519b4342a5ff.tar.bz2 |
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
Diffstat (limited to 'core/java/android/transition')
-rw-r--r-- | core/java/android/transition/TransitionManager.java | 10 |
1 files changed, 7 insertions, 3 deletions
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); } |