Work around a crash on ICS when destroying a ConversationActivity

On Ice Cream Sandwich, something -- possibly even in the Android
framework classes (not in our code) -- is passing in null to a
MessageListAdapter's unregisterOnDataSetObserver(), which causes a
crash.

We should really find out whether this is something we can properly fix
or not, but in the meantime, wrap the superclass's method with our own
method which checks for null before calling through to the superclass
implementation.
This commit is contained in:
Steven Luo 2011-11-25 02:58:16 -08:00 committed by Sebastian Kaspari
parent 5c25c86614
commit 66006cabf5
1 changed files with 12 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import org.yaaic.model.Conversation;
import org.yaaic.model.Message;
import android.content.Context;
import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
@ -162,4 +163,15 @@ public class MessageListAdapter extends BaseAdapter
{
return getItem(position);
}
/**
* XXX This is almost certainly covering up a bug elsewhere -- find it!
*/
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
if (observer == null) {
return;
}
super.unregisterDataSetObserver(observer);
}
}