From a8bc9ab2fca6a78c33c193ed08c19cce6e1a0b6f Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Wed, 20 Mar 2019 14:57:48 +0400 Subject: [PATCH] Fixed crash when starting app (NullPointer in ChatListPresenter/Fragment) --- .../chronosx88/influence/presenters/ChatListPresenter.java | 2 +- .../chronosx88/influence/views/fragments/ChatListFragment.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/github/chronosx88/influence/presenters/ChatListPresenter.java b/app/src/main/java/io/github/chronosx88/influence/presenters/ChatListPresenter.java index d1b4158..94fd534 100644 --- a/app/src/main/java/io/github/chronosx88/influence/presenters/ChatListPresenter.java +++ b/app/src/main/java/io/github/chronosx88/influence/presenters/ChatListPresenter.java @@ -14,8 +14,8 @@ public class ChatListPresenter implements ChatListPresenterContract { public ChatListPresenter(ChatListViewContract view) { this.view = view; chatListAdapter = new ChatListAdapter(); - this.view.setRecycleAdapter(chatListAdapter); this.logic = new ChatListLogic(); + this.view.setRecycleAdapter(chatListAdapter); } @Override diff --git a/app/src/main/java/io/github/chronosx88/influence/views/fragments/ChatListFragment.java b/app/src/main/java/io/github/chronosx88/influence/views/fragments/ChatListFragment.java index a0d13ee..4384a9d 100644 --- a/app/src/main/java/io/github/chronosx88/influence/views/fragments/ChatListFragment.java +++ b/app/src/main/java/io/github/chronosx88/influence/views/fragments/ChatListFragment.java @@ -28,7 +28,6 @@ public class ChatListFragment extends Fragment implements ChatListViewContract, @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - presenter = new ChatListPresenter(this); AppHelper.getObservable().register(this, MainObservable.UI_ACTIONS_CHANNEL); } @@ -42,6 +41,7 @@ public class ChatListFragment extends Fragment implements ChatListViewContract, public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); chatList = view.findViewById(R.id.chatlist_container); + presenter = new ChatListPresenter(this); presenter.updateChatList(); }