Fix a crash

This commit is contained in:
Thomas 2023-12-17 17:41:17 +01:00
parent 3148d5f9b2
commit 5b805ca9a9
13 changed files with 64 additions and 17 deletions

View file

@ -193,7 +193,11 @@ public abstract class PeertubeBaseMainActivity extends BaseActivity implements C
super.onDestroy();
ChromeCasts.unregisterListener(this);
if (manage_chromecast != null) {
unregisterReceiver(manage_chromecast);
try {
unregisterReceiver(manage_chromecast);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
new Thread(() -> {
if (chromeCasts != null && chromeCasts.size() > 0) {
for (ChromeCast cast : chromeCasts) {

View file

@ -1859,9 +1859,12 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
@Override
protected void onDestroy() {
unregisterReceiver(broadcast_data);
unregisterReceiver(broadcast_error_message);
try {
unregisterReceiver(broadcast_data);
unregisterReceiver(broadcast_error_message);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
if (networkStateReceiver != null) {
try {
unregisterReceiver(networkStateReceiver);

View file

@ -195,8 +195,11 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
if (timer != null) {
timer.cancel();
}
unregisterReceiver(imageReceiver);
try {
unregisterReceiver(imageReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}

View file

@ -367,7 +367,11 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
@Override
public void onDestroy() {
unregisterReceiver(onDownloadComplete);
try {
unregisterReceiver(onDownloadComplete);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
super.onDestroy();
}

View file

@ -1260,7 +1260,11 @@ public class ProfileActivity extends BaseActivity {
scheduledExecutorService.shutdownNow();
scheduledExecutorService = null;
}
unregisterReceiver(broadcast_data);
try {
unregisterReceiver(broadcast_data);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
super.onDestroy();
}

View file

@ -340,7 +340,11 @@ public class AdminActionActivity extends BaseBarActivity {
protected void onDestroy() {
super.onDestroy();
if (mReceiver != null) {
unregisterReceiver(mReceiver);
try {
unregisterReceiver(mReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}
}

View file

@ -295,7 +295,11 @@ public class FragmentMastodonContext extends Fragment {
@Override
public void onDestroyView() {
requireActivity().unregisterReceiver(receive_action);
try {
requireActivity().unregisterReceiver(receive_action);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
super.onDestroyView();
}

View file

@ -272,7 +272,11 @@ public class FragmentMastodonDirectMessage extends Fragment {
@Override
public void onDestroyView() {
requireActivity().unregisterReceiver(broadcast_data);
try {
requireActivity().unregisterReceiver(broadcast_data);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
super.onDestroyView();
}

View file

@ -675,8 +675,13 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
@Override
public void onDestroyView() {
requireActivity().unregisterReceiver(receive_action);
requireActivity().unregisterReceiver(receive_refresh);
try {
requireActivity().unregisterReceiver(receive_action);
requireActivity().unregisterReceiver(receive_refresh);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
if (isAdded()) {
storeMarker();
}

View file

@ -1596,7 +1596,11 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
private void unregisterReceiver() {
if (mPowerKeyReceiver != null) {
unregisterReceiver(mPowerKeyReceiver);
try {
unregisterReceiver(mPowerKeyReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
mPowerKeyReceiver = null;
}
}

View file

@ -153,7 +153,11 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
if (!keepRemote) {
typeOfConnection = TypeOfConnection.NORMAL;
}
unregisterReceiver(broadcast_data);
try {
unregisterReceiver(broadcast_data);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}
@SuppressLint("ApplySharedPref")

View file

@ -125,7 +125,11 @@ public class RetrieveInfoService extends Service implements NetworkStateReceiver
super.onDestroy();
if (networkStateReceiver != null) {
networkStateReceiver.removeListener(this);
unregisterReceiver(networkStateReceiver);
try {
unregisterReceiver(networkStateReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}
}

View file

@ -1,7 +1,7 @@
Added:
- Android 14 support
- Automatically split long messages in threads (default: ASK)
- Links and media are clickable when composing
- Links and media are clicka ble when composing
Fixed:
- Avoid error 429 with NTFY