From 924cf9d469579eed272ba1977aa3c5405f387275 Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Wed, 13 Oct 2021 12:21:33 +0200 Subject: [PATCH] Filter out null characters in groupCharactersByYear() Fixes crash when attempting to view Yui Horie's 2006 anime characters. --- .../java/com/mxt/anitrend/util/collection/GroupingUtil.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/mxt/anitrend/util/collection/GroupingUtil.kt b/app/src/main/java/com/mxt/anitrend/util/collection/GroupingUtil.kt index 09a84936d..737bfdf12 100644 --- a/app/src/main/java/com/mxt/anitrend/util/collection/GroupingUtil.kt +++ b/app/src/main/java/com/mxt/anitrend/util/collection/GroupingUtil.kt @@ -203,8 +203,11 @@ object GroupingUtil { else -> it.node.startDate.year.toString() == year } }.flatMap { mediaEdge -> - mediaEdge.characters.map { character -> - CharacterStaffBase(character, mediaEdge.node) + mediaEdge.characters.mapNotNull { character -> + if (character == null) + null + else + CharacterStaffBase(character, mediaEdge.node) } } entityMap.addAll(characters)