BenGoBlue05 / UdacityAlumni

Udacity Alumni Android App
57 stars 30 forks source link

Empty tag list in json causes App crash #42

Closed rohitkaradkar closed 7 years ago

rohitkaradkar commented 7 years ago

Steps to reproduce

when article have empty tags list, It causes App Crash

365/com.google.developer.udacityalumni E/AndroidRuntime: FATAL EXCEPTION: IntentService[AlumIntentService]
                                                                                  Process: com.google.developer.udacityalumni, PID: 1239
                                                                                  java.lang.IllegalArgumentException: n <= 0: 0
                                                                                      at java.util.Random.nextInt(Random.java:182)
                                                                                      at com.google.developer.udacityalumni.service.AlumIntentService.addArticles(AlumIntentService.java:54)
                                                                                      at com.google.developer.udacityalumni.service.AlumIntentService.onHandleIntent(AlumIntentService.java:108)
                                                                                      at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                                      at android.os.HandlerThread.run(HandlerThread.java:61)

check last article item in json response

Expected behavior

AlumIntentService should check for empty tag list in json response before using it.

PPartisan commented 7 years ago

I noticed this issue earlier this morning and issued a fix that seemed to work. Are you using the most recent version to test? [ Issue #40 ]

rohitkaradkar commented 7 years ago

no I wasn't. sorry. can I delete this issue ?