Fix various crashes

This commit is contained in:
Niels Andriesse 2021-07-09 09:24:43 +10:00
parent 176456c253
commit 004ea5b87a
4 changed files with 4 additions and 2 deletions

View File

@ -1260,7 +1260,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
} }
private fun saveDraft() { private fun saveDraft() {
val text = inputBar.text.trim() val text = inputBar?.text?.trim() ?: return
if (text.isEmpty()) { return } if (text.isEmpty()) { return }
val drafts = Drafts() val drafts = Drafts()
drafts.add(DraftDatabase.Draft(DraftDatabase.Draft.TEXT, text)) drafts.add(DraftDatabase.Draft(DraftDatabase.Draft.TEXT, text))

View File

@ -82,7 +82,7 @@ class VisibleMessageView : LinearLayout {
val senderSessionID = sender.address.serialize() val senderSessionID = sender.address.serialize()
val threadID = message.threadId val threadID = message.threadId
val threadDB = DatabaseFactory.getThreadDatabase(context) val threadDB = DatabaseFactory.getThreadDatabase(context)
val thread = threadDB.getRecipientForThreadId(threadID)!! val thread = threadDB.getRecipientForThreadId(threadID) ?: return
val contactDB = DatabaseFactory.getSessionContactDatabase(context) val contactDB = DatabaseFactory.getSessionContactDatabase(context)
val isGroupThread = thread.isGroupRecipient val isGroupThread = thread.isGroupRecipient
val isStartOfMessageCluster = isStartOfMessageCluster(message, previous, isGroupThread) val isStartOfMessageCluster = isStartOfMessageCluster(message, previous, isGroupThread)

View File

@ -883,6 +883,7 @@ public class MmsDatabase extends MessagingDatabase {
} }
public void deleteQuotedFromMessages(MessageRecord toDeleteRecord) { public void deleteQuotedFromMessages(MessageRecord toDeleteRecord) {
if (toDeleteRecord == null) { return; }
String query = THREAD_ID + " = ?"; String query = THREAD_ID + " = ?";
Cursor threadMmsCursor = rawQuery(query, new String[]{String.valueOf(toDeleteRecord.getThreadId())}); Cursor threadMmsCursor = rawQuery(query, new String[]{String.valueOf(toDeleteRecord.getThreadId())});
Reader reader = readerFor(threadMmsCursor); Reader reader = readerFor(threadMmsCursor);

View File

@ -191,6 +191,7 @@ class EnterPublicKeyFragment : Fragment() {
} }
private fun handleIsKeyboardShowingChanged() { private fun handleIsKeyboardShowingChanged() {
val optionalContentContainer = optionalContentContainer ?: return
optionalContentContainer.isVisible = !isKeyboardShowing optionalContentContainer.isVisible = !isKeyboardShowing
} }