diff options
author | Chris Tate <ctate@google.com> | 2010-11-01 15:50:35 -0700 |
---|---|---|
committer | Chris Tate <ctate@google.com> | 2010-11-01 15:50:35 -0700 |
commit | 7a0fc8776782a18374ec6e3b4418027c3c685b1a (patch) | |
tree | 10c6de4405abf313c3d13cefbfd627e4d5090e60 /cmds/bmgr | |
parent | de4077487dc32b3b00ec76f8f8ef11a02cccd0f2 (diff) | |
download | frameworks_base-7a0fc8776782a18374ec6e3b4418027c3c685b1a.zip frameworks_base-7a0fc8776782a18374ec6e3b4418027c3c685b1a.tar.gz frameworks_base-7a0fc8776782a18374ec6e3b4418027c3c685b1a.tar.bz2 |
Don't crash bmgr if there are no available restore sets
Properly guard against a null set of available restore sets when
validating the token passed to 'bmgr restore TOKEN' against what's
known to exist on the backend.
Fixes bug 3153986
Change-Id: I74bdd4c6242f682833c1633baa4fefccb2b165a7
Diffstat (limited to 'cmds/bmgr')
-rw-r--r-- | cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java index 37c8ad0..b5fddfa 100644 --- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java +++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java @@ -389,11 +389,13 @@ public final class Bmgr { if (err == 0) { observer.waitForCompletion(); sets = observer.sets; - for (RestoreSet s : sets) { - if (s.token == token) { - System.out.println("Scheduling restore: " + s.name); - didRestore = (mRestore.restoreAll(token, observer) == 0); - break; + if (sets != null) { + for (RestoreSet s : sets) { + if (s.token == token) { + System.out.println("Scheduling restore: " + s.name); + didRestore = (mRestore.restoreAll(token, observer) == 0); + break; + } } } } |