From 9aa0aee5af325ebb441e6e5ef786f363c956246d Mon Sep 17 00:00:00 2001 From: Negue Date: Mon, 21 Dec 2015 19:13:05 +0100 Subject: [PATCH] fixes #278 - NPE likes was null --- .../ui/adapter/ChatRecyclerViewAdapter.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Habitica/src/com/habitrpg/android/habitica/ui/adapter/ChatRecyclerViewAdapter.java b/Habitica/src/com/habitrpg/android/habitica/ui/adapter/ChatRecyclerViewAdapter.java index 23944abec..79f530751 100644 --- a/Habitica/src/com/habitrpg/android/habitica/ui/adapter/ChatRecyclerViewAdapter.java +++ b/Habitica/src/com/habitrpg/android/habitica/ui/adapter/ChatRecyclerViewAdapter.java @@ -249,13 +249,15 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter e : msg.likes.entrySet()) { - if (e.getValue()) { - likeCount++; - } + if(msg != null && msg.likes != null) { + for (Map.Entry e : msg.likes.entrySet()) { + if (e.getValue()) { + likeCount++; + } - if (e.getKey().equals(uuid)) { - currentUserLikedPost = true; + if (e.getKey().equals(uuid)) { + currentUserLikedPost = true; + } } }