Project Information
Repository: https://github.com/SimpleMobileTools/Simple-Contacts/
Project Name: Simple-Contacts
Publisher: https://github.com/SimpleMobileTools
Expected behaviour
When I attempt to delete a contact from contact list it should be deleted following the press of delete (no warning pop up should be provided and it should be deleted instantly).
Actual behaviour
Following the press of delete, the application will not update the view to indicate the contact has been deleted. Upon a second press of delete, the application will crash.
Note: I assume the contact has been deleted and the view has been updated, hence it can't find what it's trying to delete, therefore the crash occurs.
Pre-requisites
- This issue only seems to occur when you have 1 contact in the list, therefore you should start with an empty contact list and create one contact only and then delete it.
- I can only replicate on Android 8.0, all other version of Android tested don't seem to show this issue.
How to reproduce
- From either a fresh install or existing install go to the contact page.
- At the bottom right of the page a floating icon is present, press this icon to create a new contact.
- You can name the contact anything, for clarity let's call it "testContact"
- Save the contact and the application will show it's been created.
- Long Press the "testContact" contact item and additional options will appear
- Press the options menu located in the top right of the page
- Select delete from this list
- The contact will not be removed from the list, repeat steps 5 - 7 and a fatal exception will occur.
Logs
05-27 10:10:37.508 5332-5332/com.simplemobiletools.contacts E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.simplemobiletools.contacts, PID: 5332
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:437)
at com.simplemobiletools.contacts.a.a.v(SourceFile:148)
at com.simplemobiletools.contacts.a.a.a(SourceFile:30)
at com.simplemobiletools.contacts.a.a$b.b(SourceFile:137)
at com.simplemobiletools.contacts.a.a$b.a(SourceFile:30)
at com.simplemobiletools.commons.b.c.a(SourceFile:40)
at com.simplemobiletools.commons.b.c.a(SourceFile:19)
at com.simplemobiletools.commons.b.c$a.onClick(SourceFile:28)
at android.support.v7.app.AlertController$b.handleMessage(SourceFile:166)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Environment
Tested on multiple different Android versions both using a physical device and emulators.
Device | Android Version | Emulator/Physical | Reproducible? |
---|---|---|---|
Motorola 3 (3rd Generation) | 6.0.1 | Physical | No |
Pixel 2 | 6.0 | Emulated | No |
Pixel 2 | 7.1 | Emulated | No |
Pixel 2 | 8.0 | Emulated | Yes |
Application Version: 4.0.3
Recording of the issue
The following video shows the issue in more detail, the video was taken on the 8.0 emulator.
Proof of work
- My GitHub account: https://github.com/tobias-g1
- The issue has been reported here: https://github.com/SimpleMobileTools/Simple-Contacts/issues/180