From edfae1906a2f5c993532a0412d5efeaac5d4a9e2 Mon Sep 17 00:00:00 2001 From: cketti Date: Sun, 6 May 2012 21:02:41 +0200 Subject: [PATCH] Make sure we always have an account name when importing settings This avoids a NullPointerException in the dialog that allows selecting which accounts to import. --- src/com/fsck/k9/preferences/SettingsImporter.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/fsck/k9/preferences/SettingsImporter.java b/src/com/fsck/k9/preferences/SettingsImporter.java index a20059f47..aa55e4a34 100644 --- a/src/com/fsck/k9/preferences/SettingsImporter.java +++ b/src/com/fsck/k9/preferences/SettingsImporter.java @@ -354,7 +354,7 @@ public class SettingsImporter { } // Make sure the account name is unique - String accountName = (account.name != null) ? account.name : "Imported"; + String accountName = account.name; if (isAccountNameUsed(accountName, accounts)) { // Account name is already in use. So generate a new one by appending " (x)", where x // is the first number >= 1 that results in an unused account name. @@ -944,6 +944,11 @@ public class SettingsImporter { Log.i(K9.LOG_TAG, "Skipping account with UUID " + uuid); } + // If we couldn't find an account name use the UUID + if (account.name == null) { + account.name = uuid; + } + return account; }