Handle empty playlists correctly

Do not throw NullPointerExceptions and
IndexOutOfBoundExceptions when retrieving an empty
playlist.