Handle unexpected null cursor and don't forget to close it.
Bug: 5406071 Change-Id: Ia40cf7e5a3e32d6f364e787ee66580c685507571
This commit is contained in:
@@ -351,8 +351,11 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
||||
try {
|
||||
Cursor cursor = context.getContentResolver().query(ringtoneUri,
|
||||
new String[] { MediaStore.Audio.Media.TITLE }, null, null, null);
|
||||
if (cursor.moveToFirst()) {
|
||||
summary = cursor.getString(0);
|
||||
if (cursor != null) {
|
||||
if (cursor.moveToFirst()) {
|
||||
summary = cursor.getString(0);
|
||||
}
|
||||
cursor.close();
|
||||
}
|
||||
} catch (SQLiteException sqle) {
|
||||
// Unknown title for the ringtone
|
||||
|
Reference in New Issue
Block a user