check for null cursor

This commit is contained in:
Adrian Ulrich 2014-06-29 19:16:07 +02:00
parent 87f7838d68
commit e7f2be06ad

View File

@ -175,6 +175,7 @@ public class Song implements Comparable<Song> {
String[] projection = new String [] { MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM }; String[] projection = new String [] { MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM };
QueryTask query = MediaUtils.buildQuery(MediaUtils.TYPE_SONG, key.id, projection, null); QueryTask query = MediaUtils.buildQuery(MediaUtils.TYPE_SONG, key.id, projection, null);
Cursor cursor = query.runQuery(mContext.getContentResolver()); Cursor cursor = query.runQuery(mContext.getContentResolver());
if (cursor != null) {
if (cursor.getCount() > 0) { if (cursor.getCount() > 0) {
cursor.moveToNext(); cursor.moveToNext();
String thisArtist = cursor.getString(0); String thisArtist = cursor.getString(0);
@ -189,6 +190,7 @@ public class Song implements Comparable<Song> {
} }
cursor.close(); cursor.close();
} }
}
if (inputStream == null && (mCoverLoadMode & COVER_MODE_ANDROID) != 0) { if (inputStream == null && (mCoverLoadMode & COVER_MODE_ANDROID) != 0) {
Uri uri = Uri.parse("content://media/external/audio/media/" + key.id + "/albumart"); Uri uri = Uri.parse("content://media/external/audio/media/" + key.id + "/albumart");