mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 16:07:30 +00:00
Maybe fix oob in media preview adapter cursor adapter (#1324)
* fix: maybe fix oob exception? * fix: attachment download was broken again * refactor: wrap in an if and log warning in the bad state
This commit is contained in:
parent
443ddfa370
commit
77a18e337b
@ -47,7 +47,6 @@ import android.widget.Toast;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.core.util.Pair;
|
import androidx.core.util.Pair;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.loader.app.LoaderManager;
|
import androidx.loader.app.LoaderManager;
|
||||||
@ -534,11 +533,15 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity im
|
|||||||
|
|
||||||
viewModel.setCursor(this, data.first, leftIsRecent);
|
viewModel.setCursor(this, data.first, leftIsRecent);
|
||||||
|
|
||||||
int item = restartItem >= 0 ? restartItem : data.second;
|
if (restartItem >= 0 || data.second >= 0) {
|
||||||
mediaPager.setCurrentItem(item);
|
int item = restartItem >= 0 ? restartItem : data.second;
|
||||||
|
mediaPager.setCurrentItem(item);
|
||||||
|
|
||||||
if (item == 0) {
|
if (item == 0) {
|
||||||
viewPagerListener.onPageSelected(0);
|
viewPagerListener.onPageSelected(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "one of restartItem "+restartItem+" and data.second "+data.second+" would cause OOB exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,9 +100,10 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long)
|
|||||||
handleFailure(Error.NoSender, null)
|
handleFailure(Error.NoSender, null)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!threadRecipient.isGroupRecipient && (contact?.isTrusted == true || storage.getUserPublicKey() != sender)) {
|
if (!threadRecipient.isGroupRecipient || (contact?.isTrusted != true && storage.getUserPublicKey() != sender)) {
|
||||||
// if we aren't receiving a group message, a message from ourselves (self-send) and the contact sending is not trusted:
|
// if we aren't receiving a group message, a message from ourselves (self-send) and the contact sending is not trusted:
|
||||||
// do not continue, but do not fail
|
// do not continue, but do not fail
|
||||||
|
handleFailure(Error.NoSender, null)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user