ScreamingHawk / android-slideshow

A simple slideshow application for your mobile.
MIT License
43 stars 45 forks source link

Handle NullPointerException on ImageActivity.loadImage #120

Closed ScreamingHawk closed 6 years ago

ScreamingHawk commented 6 years ago
Caused by: java.lang.NullPointerException: 
  at link.standen.michael.slideshow.ImageActivity.loadImage (ImageActivity.java:548)
  at link.standen.michael.slideshow.ImageActivity.onCreate (ImageActivity.java:330)
  at android.app.Activity.performCreate (Activity.java:7090)

Untested but this error could possibly occur when the user selects "Play From Here" when there is nothing in the folder. Would be nice if this NullPointerException was caught and the user was bounced back to the list view with a toast saying:

No images found

or similar

patm22 commented 6 years ago

Hi, can i take it ?

ScreamingHawk commented 6 years ago

@patm22 Yes please! I haven't had the chance to properly debug this so you might have trouble testing it.

patm22 commented 6 years ago

Check for empty list is properly done. I believe that bug is somewhere else however I was not able to reproduce it. All I can do is put try catch and check whether NullPointerException occur and if yes show error toast. I already implemented this and I can create pull request, is it going to be okay?

ScreamingHawk commented 6 years ago

Sure. Submit a pull request and I'll have a look at the implementation. I wasn't able to replicate the error either. Are you bouncing the user back to the list activity as well as toasting? That would be good enough for this one I think.

patm22 commented 6 years ago

I only add finish() so ImageActivity will be destroyed and user will see the MainActivity where the list is. You can check it

ScreamingHawk commented 6 years ago

Yeah that'll do. Thanks for this! One of those things that needs to be done but I don't have the time. I'll be sure to add a thanks to the change log when I deploy this one.

Thanks again!