From 7725334f8129b3a41e2829b19ae2e19b074a6183 Mon Sep 17 00:00:00 2001 From: tobitege Date: Mon, 20 Apr 2015 15:50:44 +0200 Subject: [PATCH] Fix NPE in getHierarchicalFolder Fixes exceptions like this: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.android.mail.providers.Folder.name' on a null object reference at com.android.email.activity.setup.MailboxSettings$MailboxSettingsFolderLoaderCallbacks.getHierarchicalFolder(MailboxSettings.java:377) Change-Id: I2c5dda84439caa5d894f5706c9c6a07079cda69c --- src/com/android/email/activity/setup/MailboxSettings.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/email/activity/setup/MailboxSettings.java b/src/com/android/email/activity/setup/MailboxSettings.java index d6b649a36..e3db75930 100644 --- a/src/com/android/email/activity/setup/MailboxSettings.java +++ b/src/com/android/email/activity/setup/MailboxSettings.java @@ -374,7 +374,9 @@ public class MailboxSettings extends PreferenceActivity { Folder tmp = folder; while (tmp != null && tmp.parent != null && !tmp.parent.toString().isEmpty()) { tmp = folders.get(tmp.parent); - name = tmp.name + "/" + name; + if (tmp != null) { + name = tmp.name + "/" + name; + } } return name; }