mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
check cursor still open in attempt to fix crash seen on Galaxy Nexus
This commit is contained in:
parent
3d6a170921
commit
27935752a8
1 changed files with 29 additions and 17 deletions
|
@ -237,26 +237,38 @@ public class SMSInviteActivity extends InviteActivity {
|
||||||
Phone.NUMBER,
|
Phone.NUMBER,
|
||||||
Phone.TYPE },
|
Phone.TYPE },
|
||||||
null, null, null );
|
null, null, null );
|
||||||
|
// Have seen a crash reporting
|
||||||
|
// "android.database.StaleDataException: Attempted to access a
|
||||||
|
// cursor after it has been closed." when the query takes a
|
||||||
|
// long time to return. Be safe.
|
||||||
|
if ( null != cursor && !cursor.isClosed() ) {
|
||||||
if ( cursor.moveToFirst() ) {
|
if ( cursor.moveToFirst() ) {
|
||||||
String name =
|
String name =
|
||||||
cursor.getString( cursor.getColumnIndex( Phone.DISPLAY_NAME));
|
cursor.getString( cursor.
|
||||||
|
getColumnIndex( Phone.DISPLAY_NAME));
|
||||||
String number =
|
String number =
|
||||||
cursor.getString( cursor.getColumnIndex( Phone.NUMBER ) );
|
cursor.getString( cursor.
|
||||||
|
getColumnIndex( Phone.NUMBER ) );
|
||||||
|
|
||||||
int type = cursor.getInt( cursor.getColumnIndex( Phone.TYPE ) );
|
int type = cursor.getInt( cursor.
|
||||||
|
getColumnIndex( Phone.TYPE ) );
|
||||||
m_pendingName = name;
|
m_pendingName = name;
|
||||||
m_pendingNumber = number;
|
m_pendingNumber = number;
|
||||||
if ( Phone.TYPE_MOBILE == type ) {
|
if ( Phone.TYPE_MOBILE == type ) {
|
||||||
showConfirmThen( R.string.warn_unlimited, R.string.button_yes,
|
showConfirmThen( R.string.warn_unlimited,
|
||||||
|
R.string.button_yes,
|
||||||
POST_WARNING_ACTION );
|
POST_WARNING_ACTION );
|
||||||
} else {
|
} else {
|
||||||
m_immobileConfirmed = false;
|
m_immobileConfirmed = false;
|
||||||
String msg = Utils.format( this, R.string.warn_nomobilef,
|
String msg =
|
||||||
|
Utils.format( this, R.string.warn_nomobilef,
|
||||||
number, name );
|
number, name );
|
||||||
showConfirmThen( msg, R.string.button_yes, USE_IMMOBILE_ACTION );
|
showConfirmThen( msg, R.string.button_yes,
|
||||||
|
USE_IMMOBILE_ACTION );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
}
|
||||||
} // addPhoneNumbers
|
} // addPhoneNumbers
|
||||||
|
|
||||||
private void rebuildList( boolean checkIfAll )
|
private void rebuildList( boolean checkIfAll )
|
||||||
|
|
Loading…
Reference in a new issue