From 59f1f003cab9b5f132062f4c2269582da27b608d Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Fri, 6 May 2022 23:48:44 +0200 Subject: [PATCH] avoid NPE trying to avoid #1976 Signed-off-by: Marcel Hibbe --- .../talk/controllers/ConversationsListController.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java index 44f5a5f0d..f2732e726 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java @@ -715,9 +715,13 @@ public class ConversationsListController extends BaseController implements Searc }); recyclerView.setOnTouchListener((v, event) -> { - InputMethodManager imm = - (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); - imm.hideSoftInputFromWindow(v.getWindowToken(), 0); + if (isAttached() && (!isBeingDestroyed() || !isDestroyed())) { + InputMethodManager imm = + (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm != null) { + imm.hideSoftInputFromWindow(v.getWindowToken(), 0); + } + } return false; });