[Android] Make comparison null sensitive

Geoffrey Métais git at videolan.org
Thu Jun 23 12:53:16 CEST 2016


vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun 23 11:20:22 2016 +0200| [ff3fd210ef6632dbae37a768722eee8a45eb70f1] | committer: Geoffrey Métais

Make comparison null sensitive

(cherry picked from commit b5db02457e82852ead43e1e3fe84ae04f3553c8c)

> https://code.videolan.org/videolan/vlc-android/commit/ff3fd210ef6632dbae37a768722eee8a45eb70f1
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index dba0640..2e22318 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -347,6 +347,11 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
 
         @Override
         public int compare(MediaWrapper item1, MediaWrapper item2) {
+            if (item1 == null)
+                return item2 == null ? 0 : -1;
+            else if (item2 == null)
+                return 1;
+
             int compare = 0;
             switch (mSortBy) {
                 case SORT_BY_TITLE:



More information about the Android mailing list