From fc84344e2d3e0decf2e8d1972c910ea47ad2b145 Mon Sep 17 00:00:00 2001 From: Ezerous Date: Mon, 22 Aug 2022 21:31:41 +0300 Subject: [PATCH] fix: rare crash upon unsuccessful post editing --- .../gr/thmmy/mthmmy/activities/topic/TopicActivity.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java index c7e3f126..959a0939 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java @@ -633,8 +633,11 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo else { Timber.i("Post edit unsuccessful"); Toast.makeText(BaseApplication.getInstance().getApplicationContext(), "Edit failed!", Toast.LENGTH_SHORT).show(); - recyclerView.getChildAt(viewModel.getPostBeingEditedPosition()).setAlpha(1); - recyclerView.getChildAt(viewModel.getPostBeingEditedPosition()).setEnabled(true); + View postBeingEditedView = recyclerView.getChildAt(viewModel.getPostBeingEditedPosition()); + if (postBeingEditedView != null) { + postBeingEditedView.setAlpha(1); + postBeingEditedView.setEnabled(true); + } } } });