commit | a71f005cb01eb6992eda8dba65678fd4d6648297 | [log] [tgz] |
---|---|---|
author | Nancy Chen <nancychen@google.com> | Thu Jul 16 20:34:43 2015 -0700 |
committer | Nancy Chen <nancychen@google.com> | Thu Jul 16 20:34:43 2015 -0700 |
tree | a02469d4860c8c8ac2c8189a39b0f513898b19e5 | |
parent | ec185f4fe3f2222444366ee2005b6c2bd90f0880 [diff] |
Fix crash when deleting voicemail. Catch "file not found" exception gracefully and exit. Make null check before calling VoicemailFetchedCallback Bug: 22538959 Change-Id: Ic8a58be17da61f9b5337a2e5c89631c499473ca3
diff --git a/src/com/android/phone/vvm/omtp/fetch/VoicemailFetchedCallback.java b/src/com/android/phone/vvm/omtp/fetch/VoicemailFetchedCallback.java index bf5befd..eb6a175 100644 --- a/src/com/android/phone/vvm/omtp/fetch/VoicemailFetchedCallback.java +++ b/src/com/android/phone/vvm/omtp/fetch/VoicemailFetchedCallback.java
@@ -61,7 +61,8 @@ outputStream.write(inputBytes); } } catch (IOException e) { - Log.e(TAG, "Error writing to file: ", e); + Log.w(TAG, String.format("File not found for %s", mUri)); + return; } finally { IoUtils.closeQuietly(outputStream); }
diff --git a/src/com/android/phone/vvm/omtp/imap/ImapHelper.java b/src/com/android/phone/vvm/omtp/imap/ImapHelper.java index 1d20dbd..d68a36b 100644 --- a/src/com/android/phone/vvm/omtp/imap/ImapHelper.java +++ b/src/com/android/phone/vvm/omtp/imap/ImapHelper.java
@@ -194,6 +194,11 @@ } message = mFolder.getMessage(uid); VoicemailPayload voicemailPayload = fetchVoicemailPayload(message); + + if (voicemailPayload == null) { + return false; + } + callback.setVoicemailContent(voicemailPayload); return true; } catch (MessagingException e) {