Skip to content

Commit 747eeb4

Browse files
Tom TaylorAndroid (Google) Code Review
authored andcommitted
Merge "Thread with no recipients getting created" into jb-dev
2 parents ca90d6d + aad847c commit 747eeb4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

core/java/com/google/android/mms/pdu/PduPersister.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,9 +1058,10 @@ public void updateHeaders(Uri uri, SendReq sendReq) {
10581058
}
10591059
}
10601060
}
1061-
1062-
long threadId = Threads.getOrCreateThreadId(mContext, recipients);
1063-
values.put(Mms.THREAD_ID, threadId);
1061+
if (!recipients.isEmpty()) {
1062+
long threadId = Threads.getOrCreateThreadId(mContext, recipients);
1063+
values.put(Mms.THREAD_ID, threadId);
1064+
}
10641065

10651066
SqliteWrapper.update(mContext, mContentResolver, uri, values, null, null);
10661067
}
@@ -1299,7 +1300,6 @@ public Uri persist(GenericPdu pdu, Uri uri) throws MmsException {
12991300
}
13001301

13011302
HashSet<String> recipients = new HashSet<String>();
1302-
long threadId = DUMMY_THREAD_ID;
13031303
int msgType = pdu.getMessageType();
13041304
// Here we only allocate thread ID for M-Notification.ind,
13051305
// M-Retrieve.conf and M-Send.req.
@@ -1326,9 +1326,11 @@ public Uri persist(GenericPdu pdu, Uri uri) throws MmsException {
13261326
}
13271327
}
13281328
}
1329-
threadId = Threads.getOrCreateThreadId(mContext, recipients);
1329+
if (!recipients.isEmpty()) {
1330+
long threadId = Threads.getOrCreateThreadId(mContext, recipients);
1331+
values.put(Mms.THREAD_ID, threadId);
1332+
}
13301333
}
1331-
values.put(Mms.THREAD_ID, threadId);
13321334

13331335
// Save parts first to avoid inconsistent message is loaded
13341336
// while saving the parts.

0 commit comments

Comments
 (0)