[Error] Crash if wallpaper collection becomes empty
Confirmation
- [x] I have read the Code of Conduct
- [x] I have searched the existing issues
Error Description
Peristyle crashes if wallpaper collection becomes empty by moving files with a different app for example.
Steps to Reproduce
Have a collection of wallpapers specified, in my case a folder Move all of the images in the collection to a different place on phone storage Wallpaper goes blank Try to open Peristyle to reset the wallpaper collection location Crash with this message:
Expected Behavior
Allow the app to open and change the wallpaper collection
Error Logs
java.util.NoSuchElementException: Collection is empty.
at kotlin.collections.CollectionsKt.random(SourceFile:33)
at app.simple.peri.abstraction.AbstractAutoWallpaperService$getRandomWallpaperFromDatabase$2.invokeSuspend(SourceFile:215)
at app.simple.peri.abstraction.AbstractAutoWallpaperService$getRandomWallpaperFromDatabase$2.invoke(SourceFile:13)
at kotlin.io.ByteStreamsKt.startUndispatchedOrReturn(SourceFile:5)
at kotlinx.coroutines.JobKt.withContext(SourceFile:78)
at app.simple.peri.abstraction.AbstractAutoWallpaperService.getRandomWallpaperFromDatabase(SourceFile:11)
at app.simple.peri.services.AutoWallpaperService.getHomeScreenWallpaper(SourceFile:307)
at app.simple.peri.abstraction.AbstractAutoLiveWallpaperService$postLiveWallpaper$1.invokeSuspend(SourceFile:157)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:9)
at kotlinx.coroutines.DispatchedTask.run(SourceFile:115)
at androidx.core.app.ActivityRecreator$1.run(SourceFile:13)
at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:94)
Device Information
Xiaomi 12 Android 14
Additional Context
No response
Sufficiency Confirmation
- [x] I have provided all the information requested above and deemed sufficient for the developer to address the issue
I have fixed the issue, please run the APK from here and check if the app is opening now? Also, the error notification is a part of the process of auto wallpaper, it may still show error notification, but the app should not crash now and will let you update the source of your collection.
https://github.com/Hamza417/Peristyle/actions/runs/14672925379
The previous run failed due to misconfiguration, get the test file from this run: https://github.com/Hamza417/Peristyle/actions/runs/14673213516
This is a little bit better, but I still get a crash. No notification or logs though this time. Process:
- Uninstall fdroid version
- Create a test folder with an image in to make the collection
- Install test version
- Allow all permissioms
- Select test folder as collection source
- Set wallpaper using live wallpaper mode
- Wallpaper gets set successfully
- Delete image from test folder
- Try to launch Peristyle
- Wallpaper goes black and app never opens
- Try and open again, crashes again
- Try again os reports crashing app, still does open
- Try again, app opens and wallpaper resets to a default
- Can now reselect a collection
There was no crash notification this time so I have no logs to attach unless they are stored on disk somewhere?
I'm occupied with some college issues lately, I'll get back to this issue and possibly with proper fixes once I have dealt with the tasks at hand.
No problem! Just trying to help make the app better. It's great that you're developing this open source, it's a cool app so keep going 😊
Thanks :), could you now run the app again? It should be fixed now
https://github.com/Hamza417/Peristyle/actions/runs/14902924757
Thanks :), could you now run the app again? It should be fixed now
https://github.com/Hamza417/Peristyle/actions/runs/14902924757
Use this run for test build: https://github.com/Hamza417/Peristyle/actions/runs/14903473377