[Android] Make comparison null sensitive

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


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

Make comparison null sensitive

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

 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