Merge branch '2059-no-such-group-exception' into 'master'

Check if group still exists before storing MessageId of thread position

Closes #2059

See merge request briar/briar!1477
This commit is contained in:
akwizgran
2021-06-14 14:57:21 +00:00

View File

@@ -5,6 +5,7 @@ import android.app.Application;
import org.briarproject.bramble.api.crypto.CryptoExecutor;
import org.briarproject.bramble.api.db.DatabaseExecutor;
import org.briarproject.bramble.api.db.DbException;
import org.briarproject.bramble.api.db.NoSuchGroupException;
import org.briarproject.bramble.api.db.TransactionManager;
import org.briarproject.bramble.api.event.Event;
import org.briarproject.bramble.api.event.EventBus;
@@ -215,11 +216,15 @@ public abstract class ThreadListViewModel<I extends ThreadItem>
return replyId;
}
@UiThread
void storeMessageId(@Nullable MessageId messageId) {
if (messageId != null) {
runOnDbThread(() -> {
try {
messageTracker.storeMessageId(groupId, messageId);
} catch (NoSuchGroupException e) {
// This can happen when the activity is closed
// after deleting the group. So just ignore this case.
} catch (DbException e) {
handleException(e);
}