OSDN Git Service

Don't crash even when voiceMailNumber is null, which is a valid condition.
authorMakoto Onuki <omakoto@google.com>
Thu, 8 Oct 2009 18:55:54 +0000 (11:55 -0700)
committerMakoto Onuki <omakoto@google.com>
Thu, 8 Oct 2009 18:55:54 +0000 (11:55 -0700)
Fixes bug internal issue 2162197

tests/src/com/android/contacts/RecentCallsListActivityTests.java

index 2cdd8d7..afa1a7a 100644 (file)
@@ -276,7 +276,7 @@ public class RecentCallsListActivityTests
             duration = mRnd.nextInt(10 * 60);  // 0 - 10 minutes random.
         }
         row.add(duration);  // duration
-        if (mVoicemail.equals(number)) {
+        if (mVoicemail != null && mVoicemail.equals(number)) {
             assertEquals(Calls.OUTGOING_TYPE, type);
         }
         row.add(type);  // type
@@ -309,7 +309,10 @@ public class RecentCallsListActivityTests
      * @param duration In seconds of the call. Use RAND_DURATION to pick a random one.
      */
     private void insertVoicemail(long date, int duration) {
-        insert(mVoicemail, date, duration, Calls.OUTGOING_TYPE);
+        // mVoicemail may be null
+        if (mVoicemail != null) {
+            insert(mVoicemail, date, duration, Calls.OUTGOING_TYPE);
+        }
     }
 
     /**