diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/DBHelper.kt index 860b3698..26da1385 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/DBHelper.kt @@ -283,14 +283,27 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont val phoneNumbers = if (phoneNumbersJson == "[]") ArrayList() else gson.fromJson>(phoneNumbersJson, phoneNumbersToken) ?: ArrayList(1) + // labels can be null at upgrading from older app versions, when the label wasn't available at all yet + phoneNumbers.filter { it.label == null }.forEach { + it.label = "" + } + val emailsJson = cursor.getStringValue(COL_EMAILS) val emails = if (emailsJson == "[]") ArrayList() else gson.fromJson>(emailsJson, emailsToken) ?: ArrayList(1) + emails.filter { it.label == null }.forEach { + it.label = "" + } + val addressesJson = cursor.getStringValue(COL_ADDRESSES) val addresses = if (addressesJson == "[]") ArrayList() else gson.fromJson>(addressesJson, addressesToken) ?: ArrayList(1) + addresses.filter { it.label == null }.forEach { + it.label = "" + } + val eventsJson = cursor.getStringValue(COL_EVENTS) val events = if (eventsJson == "[]") ArrayList() else gson.fromJson>(eventsJson, eventsToken) ?: ArrayList(1)