diff --git a/src/main/java/com/zegoggles/smssync/mail/MessageGenerator.java b/src/main/java/com/zegoggles/smssync/mail/MessageGenerator.java index fd5db44c3..3480b24d9 100644 --- a/src/main/java/com/zegoggles/smssync/mail/MessageGenerator.java +++ b/src/main/java/com/zegoggles/smssync/mail/MessageGenerator.java @@ -161,7 +161,7 @@ public MessageGenerator(Context context, final String address = msgMap.get(CallLog.Calls.NUMBER); final int callType = toInt(msgMap.get(CallLog.Calls.TYPE)); - if (TextUtils.isEmpty(address) || !mCallLogTypes.isTypeEnabled(callType)) { + if (!mCallLogTypes.isTypeEnabled(callType)) { if (LOCAL_LOGV) Log.v(TAG, "ignoring call log entry: " + msgMap); return null; } diff --git a/src/test/java/com/zegoggles/smssync/mail/MessageGeneratorTest.java b/src/test/java/com/zegoggles/smssync/mail/MessageGeneratorTest.java index 4236074f2..357fae303 100644 --- a/src/test/java/com/zegoggles/smssync/mail/MessageGeneratorTest.java +++ b/src/test/java/com/zegoggles/smssync/mail/MessageGeneratorTest.java @@ -127,6 +127,15 @@ public class MessageGeneratorTest { assertThat(msg.getRecipients(Message.RecipientType.TO)[0]).isEqualTo(me); } + @Test public void testShouldGenerateMessageForCallLogIncomingUnknown() throws Exception { + PersonRecord record = new PersonRecord(0, null, null, "-1"); + Message msg = generator.messageForDataType(mockCalllogMessage("", CallLog.Calls.INCOMING_TYPE, record), DataType.CALLLOG); + assertThat(msg).isNotNull(); + assertThat(msg.getSubject()).isEqualTo("Call with Unknown"); + assertThat(msg.getFrom()[0].toString()).isEqualTo("Unknown "); + assertThat(msg.getRecipients(Message.RecipientType.TO)[0]).isEqualTo(me); + } + @Test public void testShouldGenerateCallLogMessageWithCorrectEncoding() throws Exception { PersonRecord record = new PersonRecord(-1, "Test Testor", null, null); Message msg = generator.messageForDataType(mockCalllogMessage("1234", CallLog.Calls.OUTGOING_TYPE, record), DataType.CALLLOG);