[jitsi-dev] [PATCH] Android: Fix crash when moving contact to group


#1

To reproduce bug:

- Launch jitsi for Android and sign into an XMPP account
- Long tap on a contact in the contact list
- Select 'move to group'
- Select 'create new group'
- A new dialog opens, asking for the name of the new group
- Press cancel
- Press 'move'
- jitsi crashes

Relevant stacktrace:

java.lang.ClassCastException: java.lang.Object cannot be cast to
net.java.sip.communicator.service.contactlist.MetaContactGroup
at
org.jitsi.android.gui.contactlist.MoveToGroupDialog$1.onClick(MoveToGroupDialog.java:76)

The return value of groupList.getSelectedItem() on
MoveToGroupDialog.java:76 is the MetaContactGroupAdapter.ADD_NEW_OBJECT
sentinel object, representing the "create new group" spinner item. The
proposed fix introduces a new public method in MetaContactGroupAdapter
to distinguish this dummy item from the spinner items representing
actual contact groups. When the dummy item is selected now, the 'move'
button will not click.

fix-move-contact-to-group.patch (1.51 KB)