diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java index 1f4264aad..fe10e0d9c 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java @@ -255,8 +255,10 @@ public class MainActivity extends SimpleActivity private void deleteItem(File file) { if (Utils.Companion.needsStupidWritePermissions(this, file.getAbsolutePath())) { - final DocumentFile document = Utils.Companion.getFileDocument(this, file.getAbsolutePath()); - document.delete(); + if (!Utils.Companion.isShowingWritePermissions(this, new File(file.getAbsolutePath()))) { + final DocumentFile document = Utils.Companion.getFileDocument(this, file.getAbsolutePath()); + document.delete(); + } } else { file.delete(); }