Commit f5e0f948 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Prevent NPE

CID #1297077
parent c8687687
......@@ -41,6 +41,7 @@ import android.database.sqlite.SQLiteOpenHelper;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.support.annotation.Nullable;
import android.util.Log;
public class MediaDatabase {
......@@ -421,6 +422,7 @@ public class MediaDatabase {
* @param playlistName Unique name of the playlist
* @return Array containing MRLs of the playlist in order, or null on error
*/
@Nullable
public String[] playlistGetItems(String playlistName) {
if(!playlistExists(playlistName))
return null;
......
......@@ -194,6 +194,8 @@ public class MediaLibrary {
String[] items, playlistNames = db.getPlaylists();
for (String playlistName : playlistNames){
items = db.playlistGetItems(playlistName);
if (items == null)
continue;
playList = new AudioBrowserListAdapter.ListItem(playlistName, null, null, false);
for (String track : items){
playList.mMediaList.add(new MediaWrapper(track));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment