Peristyle icon indicating copy to clipboard operation
Peristyle copied to clipboard

[Error] Crash if wallpaper collection becomes empty

Open NickAnEngineer opened this issue 10 months ago • 7 comments

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:

Image

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

NickAnEngineer avatar Apr 25 '25 20:04 NickAnEngineer

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

Hamza417 avatar Apr 25 '25 20:04 Hamza417

The previous run failed due to misconfiguration, get the test file from this run: https://github.com/Hamza417/Peristyle/actions/runs/14673213516

Hamza417 avatar Apr 25 '25 20:04 Hamza417

This is a little bit better, but I still get a crash. No notification or logs though this time. Process:

  1. Uninstall fdroid version
  2. Create a test folder with an image in to make the collection
  3. Install test version
  4. Allow all permissioms
  5. Select test folder as collection source
  6. Set wallpaper using live wallpaper mode
  7. Wallpaper gets set successfully
  8. Delete image from test folder
  9. Try to launch Peristyle
  10. Wallpaper goes black and app never opens
  11. Try and open again, crashes again
  12. Try again os reports crashing app, still does open
  13. Try again, app opens and wallpaper resets to a default
  14. 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?

NickAnEngineer avatar Apr 26 '25 10:04 NickAnEngineer

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.

Hamza417 avatar Apr 26 '25 20:04 Hamza417

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 😊

NickAnEngineer avatar Apr 27 '25 17:04 NickAnEngineer

Thanks :), could you now run the app again? It should be fixed now

https://github.com/Hamza417/Peristyle/actions/runs/14902924757

Hamza417 avatar May 08 '25 09:05 Hamza417

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

Hamza417 avatar May 08 '25 09:05 Hamza417