am 040ad494: Merge "Handle unexpected null cursor and don\'t forget to close it."

* commit '040ad494c5560e83ab8c0414b303aa3f1e1f34bf':
  Handle unexpected null cursor and don't forget to close it.
This commit is contained in:
Amith Yamasani
2011-10-04 15:30:12 -07:00
committed by Android Git Automerger

View File

@@ -351,8 +351,11 @@ public class SoundSettings extends SettingsPreferenceFragment implements
try { try {
Cursor cursor = context.getContentResolver().query(ringtoneUri, Cursor cursor = context.getContentResolver().query(ringtoneUri,
new String[] { MediaStore.Audio.Media.TITLE }, null, null, null); new String[] { MediaStore.Audio.Media.TITLE }, null, null, null);
if (cursor.moveToFirst()) { if (cursor != null) {
summary = cursor.getString(0); if (cursor.moveToFirst()) {
summary = cursor.getString(0);
}
cursor.close();
} }
} catch (SQLiteException sqle) { } catch (SQLiteException sqle) {
// Unknown title for the ringtone // Unknown title for the ringtone