Fix null message handling

This commit is contained in:
nielsandriesse 2020-07-13 14:40:42 +10:00
parent fd4ed74892
commit 588bf32965
2 changed files with 3 additions and 2 deletions

View File

@ -801,7 +801,8 @@ public class ConversationItem extends LinearLayout
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)bodyBubble.getLayoutParams(); LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)bodyBubble.getLayoutParams();
int groupThreadMargin = (int)((12 * getResources().getDisplayMetrics().density) + getResources().getDimension(R.dimen.small_profile_picture_size)); int groupThreadMargin = (int)((12 * getResources().getDisplayMetrics().density) + getResources().getDimension(R.dimen.small_profile_picture_size));
int defaultMargin = 0; int defaultMargin = 0;
String threadName = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(messageRecord.getThreadId()).getName(); Recipient r = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(messageRecord.getThreadId());
String threadName = r != null ? r.getName() : "";
boolean isRSSFeed = threadName != null && (threadName.equals("Loki News") || threadName.equals("Session Updates")); boolean isRSSFeed = threadName != null && (threadName.equals("Loki News") || threadName.equals("Session Updates"));
layoutParams.setMarginStart((groupThread && !isRSSFeed) ? groupThreadMargin : defaultMargin); layoutParams.setMarginStart((groupThread && !isRSSFeed) ? groupThreadMargin : defaultMargin);
bodyBubble.setLayoutParams(layoutParams); bodyBubble.setLayoutParams(layoutParams);

View File

@ -367,7 +367,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
else if (message.isDeliveryReceipt()) handleDeliveryReceipt(content, message); else if (message.isDeliveryReceipt()) handleDeliveryReceipt(content, message);
} else if (content.getTypingMessage().isPresent()) { } else if (content.getTypingMessage().isPresent()) {
handleTypingMessage(content, content.getTypingMessage().get()); handleTypingMessage(content, content.getTypingMessage().get());
} else { } else if (content.isNullMessage()) {
// Loki - This is needed for compatibility with refactored desktop clients // Loki - This is needed for compatibility with refactored desktop clients
// ======== // ========