If all lists are deleted, an attempt to share or delete a list crashes the app
Closed this issue · 2 comments
espoem commented
Expected behaviour
If there is no list, the user should be warned that there is none to share or delete.
Actual behaviour
If the user deletes all lists so he can see "No lists are available", the attempt of sharing or deleting a list causes the app crash.
Steps to reproduce
- Delete all lists (including the default one)
- Click the three dots menu
- Share or delete a list
Logcat
05-03 11:46:40.253 31893 31893 E AndroidRuntime: FATAL EXCEPTION: main
05-03 11:46:40.253 31893 31893 E AndroidRuntime: Process: com.woefe.shoppinglist, PID: 31893
05-03 11:46:40.253 31893 31893 E AndroidRuntime: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.woefe.shoppinglist.shoppinglist.ShoppingListsManager$ShoppingListMetadata.filename' on a null object reference
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at com.woefe.shoppinglist.shoppinglist.ShoppingListsManager$ShoppingListMetadata.access$1000(ShoppingListsManager.java:239)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at com.woefe.shoppinglist.shoppinglist.ShoppingListsManager$MetadataContainer.removeByName(ShoppingListsManager.java:271)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at com.woefe.shoppinglist.shoppinglist.ShoppingListsManager$MetadataContainer.access$1400(ShoppingListsManager.java:252)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at com.woefe.shoppinglist.shoppinglist.ShoppingListsManager.removeList(ShoppingListsManager.java:211)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at com.woefe.shoppinglist.shoppinglist.ShoppingListService$ShoppingListBinder.removeList(ShoppingListService.java:92)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at com.woefe.shoppinglist.activity.MainActivity.onPositiveButtonClicked(MainActivity.java:281)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at com.woefe.shoppinglist.dialog.ConfirmationDialog$2.onClick(ConfirmationDialog.java:78)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:171)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:110)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at android.os.Looper.loop(Looper.java:203)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6297)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
05-03 11:46:40.253 31893 31893 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)
- OS: Android 7.1.1
- app version 0.9.0
woefe commented
espoem commented
Right, I am sorry for the duplicate report. I have overlooked it. Thank you for the fast response.