Fix crash when deleting a lonely image

This commit is contained in:
Matéo Duparc 2021-04-07 17:39:10 +02:00
parent 8da43a4452
commit a4db2740a1
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E
1 changed files with 2 additions and 1 deletions

View File

@ -119,7 +119,8 @@ class ImageViewer: FileViewerActivity() {
.keepFullScreen()
.setTitle(R.string.warning)
.setPositiveButton(R.string.ok) { _, _ ->
if (gocryptfsVolume.removeFile(filePath)){
createPlaylist() //be sure the playlist is created before deleting if there is only one image
if (gocryptfsVolume.removeFile(filePath)) {
playlistNext(true)
refreshPlaylist()
if (mappedPlaylist.size == 0) { //deleted all images of the playlist