From 0a7e7cfd098a6cf671d737118e4daf1f11634b8e Mon Sep 17 00:00:00 2001 From: Shriom Date: Tue, 15 May 2018 15:14:55 +0530 Subject: [PATCH] Removed null pointer exception on recyclerView adapters. --- .../example/android/audacity/adapters/ChallengesAdapter.java | 2 +- .../example/android/audacity/adapters/HottestAppAdapter.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/android/audacity/adapters/ChallengesAdapter.java b/app/src/main/java/com/example/android/audacity/adapters/ChallengesAdapter.java index 8d92e92..f0692da 100644 --- a/app/src/main/java/com/example/android/audacity/adapters/ChallengesAdapter.java +++ b/app/src/main/java/com/example/android/audacity/adapters/ChallengesAdapter.java @@ -51,7 +51,7 @@ public void onBindViewHolder(@NonNull ViewHolder holder, int position) { @Override public int getItemCount() { - return mChallengeData.size(); + return mChallengeData == null ? 0 : mChallengeData.size(); } public class ViewHolder extends RecyclerView.ViewHolder { diff --git a/app/src/main/java/com/example/android/audacity/adapters/HottestAppAdapter.java b/app/src/main/java/com/example/android/audacity/adapters/HottestAppAdapter.java index c2254b3..f72592d 100644 --- a/app/src/main/java/com/example/android/audacity/adapters/HottestAppAdapter.java +++ b/app/src/main/java/com/example/android/audacity/adapters/HottestAppAdapter.java @@ -51,7 +51,7 @@ public void onBindViewHolder(@NonNull ViewHolder holder, int position) { @Override public int getItemCount() { - return mHottestAppData.size(); + return mHottestAppData == null ? 0 : mHottestAppData.size(); } public class ViewHolder extends RecyclerView.ViewHolder {