File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/org/thoughtcrime/securesms/mediasend Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 13
13
import com .annimon .stream .Stream ;
14
14
15
15
import org .thoughtcrime .securesms .TransportOption ;
16
+ import org .thoughtcrime .securesms .logging .Log ;
16
17
import org .thoughtcrime .securesms .mms .MediaConstraints ;
17
18
import org .thoughtcrime .securesms .providers .BlobProvider ;
18
19
import org .thoughtcrime .securesms .util .MediaUtil ;
31
32
*/
32
33
class MediaSendViewModel extends ViewModel {
33
34
35
+ private static final String TAG = MediaSendViewModel .class .getSimpleName ();
36
+
34
37
private static final int MAX_PUSH = 32 ;
35
38
private static final int MAX_SMS = 1 ;
36
39
@@ -176,10 +179,20 @@ void onFolderSelected(@NonNull String bucketId) {
176
179
}
177
180
178
181
void onPageChanged (int position ) {
182
+ if (position < 0 || position >= getSelectedMediaOrDefault ().size ()) {
183
+ Log .w (TAG , "Tried to move to an out-of-bounds item. Size: " + getSelectedMediaOrDefault ().size () + ", position: " + position );
184
+ return ;
185
+ }
186
+
179
187
this .position .setValue (position );
180
188
}
181
189
182
190
void onMediaItemRemoved (@ NonNull Context context , int position ) {
191
+ if (position < 0 || position >= getSelectedMediaOrDefault ().size ()) {
192
+ Log .w (TAG , "Tried to remove an out-of-bounds item. Size: " + getSelectedMediaOrDefault ().size () + ", position: " + position );
193
+ return ;
194
+ }
195
+
183
196
Media removed = getSelectedMediaOrDefault ().remove (position );
184
197
185
198
if (removed != null && BlobProvider .isAuthority (removed .getUri ())) {
You can’t perform that action at this time.
0 commit comments