prevent a crash in ComposeActivity when ContentResolver raises a SecurityException
This commit is contained in:
parent
2dfd83ef97
commit
9df3836665
1 changed files with 7 additions and 3 deletions
|
@ -37,7 +37,6 @@ import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.support.annotation.AttrRes;
|
import android.support.annotation.AttrRes;
|
||||||
import android.support.annotation.LayoutRes;
|
import android.support.annotation.LayoutRes;
|
||||||
|
@ -968,9 +967,14 @@ public final class ComposeActivity extends BaseActivity implements ComposeOption
|
||||||
status.setUid(savedTootUid);
|
status.setUid(savedTootUid);
|
||||||
tootDao.delete(status);
|
tootDao.delete(status);
|
||||||
for (QueuedMedia item : mediaQueued) {
|
for (QueuedMedia item : mediaQueued) {
|
||||||
if (getContentResolver().delete(item.uri, null, null) == 0) {
|
try {
|
||||||
Log.e(TAG, String.format("Did not delete file %s.", item.uri.toString()));
|
if (getContentResolver().delete(item.uri, null, null) == 0) {
|
||||||
|
Log.e(TAG, String.format("Did not delete file %s.", item.uri.toString()));
|
||||||
|
}
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
Log.e(TAG, String.format("Did not delete file %s.", item.uri.toString()), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Snackbar bar = Snackbar.make(findViewById(R.id.activity_compose),
|
Snackbar bar = Snackbar.make(findViewById(R.id.activity_compose),
|
||||||
|
|
Loading…
Reference in a new issue