Fix NPE in ContactListFragment

Closes #562
This commit is contained in:
Torsten Grote
2016-08-01 16:26:01 -03:00
parent a51d2f47af
commit 31cd6e8958
2 changed files with 16 additions and 8 deletions

View File

@@ -9,6 +9,7 @@ import org.briarproject.api.introduction.IntroductionMessage;
import org.briarproject.api.introduction.IntroductionRequest;
import org.briarproject.api.introduction.IntroductionResponse;
import org.briarproject.api.messaging.PrivateMessageHeader;
import org.briarproject.api.sharing.InvitationMessage;
import org.briarproject.api.sync.MessageId;
// This class is not thread-safe
@@ -138,7 +139,7 @@ public abstract class ConversationItem {
/**
* This method should not be used to get user-facing objects,
* Its purpose is to provider data for the contact list.
* Its purpose is only to provide data for the contact list.
*/
public static ConversationItem from(IntroductionMessage im) {
if (im.isLocal())
@@ -148,6 +149,18 @@ public abstract class ConversationItem {
im.getTimestamp(), im.isRead());
}
/**
* This method should not be used to get user-facing objects,
* Its purpose is only to provide data for the contact list.
*/
public static ConversationItem from(InvitationMessage im) {
if (im.isLocal())
return new ConversationNoticeOutItem(im.getId(), "",
im.getTimestamp(), false, false);
return new ConversationNoticeInItem(im.getId(), "",
im.getTimestamp(), im.isRead());
}
interface OutgoingItem {
MessageId getId();