From: rmceoin Date: Wed, 23 Sep 2009 03:55:36 +0000 (+0000) Subject: OI Safe: catch a couple of NPEs X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=1b3cb1b7a847d0866f696cf0f1d97c5487d6f109;p=android-vcpass-oisafe OI Safe: catch a couple of NPEs git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2307 72b678ce-9140-0410-bee8-679b907dd61a --- diff --git a/src/org/openintents/safe/PassList.java b/src/org/openintents/safe/PassList.java index f4b9956..e3cadb4 100644 --- a/src/org/openintents/safe/PassList.java +++ b/src/org/openintents/safe/PassList.java @@ -290,10 +290,12 @@ public class PassList extends ListActivity { public void run(){ rows=Passwords.getPassEntries(CategoryId, true, true); passDescriptions.clear(); - Iterator passIter=rows.iterator(); - while (passIter.hasNext()) { - PassEntry passEntry=passIter.next(); - passDescriptions.add(passEntry.plainDescription); + if (rows!=null) { + Iterator passIter=rows.iterator(); + while (passIter.hasNext()) { + PassEntry passEntry=passIter.next(); + passDescriptions.add(passEntry.plainDescription); + } } // dismissDialog(DECRYPT_PROGRESS_KEY); // forced to removeDialog(), without it diff --git a/src/org/openintents/safe/Passwords.java b/src/org/openintents/safe/Passwords.java index 231317e..fbd2a77 100644 --- a/src/org/openintents/safe/Passwords.java +++ b/src/org/openintents/safe/Passwords.java @@ -303,6 +303,9 @@ public class Passwords { public static PassEntry getPassEntry(Long id, boolean decrypt, boolean descriptionOnly) { if (debug) Log.d(TAG,"getPassEntry("+id+")"); + if ((id==null) || (passEntries==null)) { + return null; + } PassEntry passEntry=passEntries.get(id); if (passEntry==null) { return null; diff --git a/tests/test-procedure.html b/tests/test-procedure.html new file mode 100644 index 0000000..7b3b037 --- /dev/null +++ b/tests/test-procedure.html @@ -0,0 +1,68 @@ + + +

Test Procedure

+ + +
    +
  1. Uninstall OI Safe from emulator or device: +
    +adb uninstall org.openintents.safe
    +
    +

    You may want to Backup the database first with Menu->Backup

    +
  2. + +
  3. Install OI Safe and launch. +

    In Eclipse: right-click project OI Safe -> Run As -> Android Application

    +

    Or if build-private.properties is configured: project OI Safe -> (right-click) +build.xml -> Run As -> Ant Build

    +
  4. + +
  5. +

    Launch OI Safe. Should be presented with EULA. Hit Cancel. Application should quit.

    +
  6. + +
  7. +

    Launch OI Safe. At EULA, hit Accept. Should be presented with +AskPassword activity asking to create Master Password. +Leave fields empty.

    +
  8. + +
  9. Hit Continue. Toast should remind user to provide at +least 4 characters of password.
  10. + +
  11. Type password in Master Password, leave Confirm empty. Hit Continue. +Toast should tell user that passwords do not match.
  12. + +
  13. Type correct password into Continue field. Hit Continue. +CategoryList should activiate with a dialog letting user know that +they should backup. Hit OK. +
  14. + +
  15. At CategoryList, hit Menu->Add. CategoryEdit should launch.
  16. + +
  17. Leave blank and hit Save. Toast should complain about being empty. +Provide a name and hit Save. Should fall back to CategoryList with the new +category in the list.
  18. + +
  19. Long-click the newly created category and hit Delete. Because it's empty +it should disappear from the list.
  20. + + +
  21. Uninstall OI Safe and reinstall. Launch. Instead of providing a new Master +Password, hit Restore. Restore Activity should launch. +
  22. + +
  23. Provide wrong password for oisafe.xml. Hit Restore. Toast should indicate bad password. +
  24. + +
  25. Provide correct password for oisafe.xml. Hit Restore. Dialog should prompt to overwrite +existing data. Hit No. Should drop back. Hit Restore and hit Yes. CategoryList +should launch with restored data.
  26. + +
+ + +