Simple-Contacts [4.0.3] - Fatal exception when deleting only contact on list multiple times

in #utopian-io6 years ago

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

  1. From either a fresh install or existing install go to the contact page.
  2. At the bottom right of the page a floating icon is present, press this icon to create a new contact.
  3. You can name the contact anything, for clarity let's call it "testContact"
  4. Save the contact and the application will show it's been created.
  5. Long Press the "testContact" contact item and additional options will appear
  6. Press the options menu located in the top right of the page
  7. Select delete from this list
  8. 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.

DeviceAndroid VersionEmulator/PhysicalReproducible?
Motorola 3 (3rd Generation)6.0.1PhysicalNo
Pixel 26.0EmulatedNo
Pixel 27.1EmulatedNo
Pixel 28.0EmulatedYes

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

Sort:  

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

In light of keeping my post as clean as possible without comments like this, I was unsure to post this as I know it won't affect the large majority of users hence why I posted to GitHub some hours ago, but as the project owner didn't query it and acknowledged it (marked as bug) I felt it provided some value to the project.

Exellent

Hey @tobias-g
Thanks for contributing on Utopian.
Congratulations! Your contribution was Staff Picked to receive a maximum vote for the bug-hunting category on Utopian for being of significant value to the project and the open source community.

We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

This is a test comment

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 63475.77
ETH 3117.23
USDT 1.00
SBD 3.94