From 21eb98a52ca286d009baa5bfe3f6c572f620069c Mon Sep 17 00:00:00 2001 From: kapodamy Date: Thu, 24 Jan 2019 23:23:30 -0300 Subject: [PATCH] add null check add checks for null. This happens after rotating the screen while is turned off --- .../java/us/shandian/giga/ui/adapter/MissionAdapter.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java b/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java index 1b5b98145..8fca7c470 100644 --- a/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java +++ b/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java @@ -159,7 +159,7 @@ public class MissionAdapter extends Adapter { str = R.string.missions_header_pending; } else { str = R.string.missions_header_finished; - mClear.setVisible(true); + if (mClear != null) mClear.setVisible(true); } ((ViewHolderHeader) view).header.setText(str); @@ -437,7 +437,6 @@ public class MissionAdapter extends Adapter { public void clearFinishedDownloads() { mDownloadManager.forgetFinishedDownloads(); applyChanges(); - mClear.setVisible(false); } private boolean handlePopupItem(@NonNull ViewHolderItem h, @NonNull MenuItem option) { @@ -507,7 +506,7 @@ public class MissionAdapter extends Adapter { mIterator.end(); checkEmptyMessageVisibility(); - mClear.setVisible(mIterator.hasFinishedMissions()); + if (mClear != null) mClear.setVisible(mIterator.hasFinishedMissions()); } public void forceUpdate() {