mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-01-03 14:40:07 +02:00
Fix some crashes
This commit is contained in:
parent
197dba1658
commit
c998ef1f56
3 changed files with 36 additions and 33 deletions
|
@ -97,6 +97,7 @@ public class ContextActivity extends BaseActivity {
|
|||
}).start();
|
||||
StatusesVM timelinesVM = new ViewModelProvider(ContextActivity.this).get(StatusesVM.class);
|
||||
timelinesVM.getStatus(MainActivity.currentInstance, MainActivity.currentToken, focusedStatus.id).observe(ContextActivity.this, status -> {
|
||||
if (status != null) {
|
||||
StatusCache statusCache = new StatusCache();
|
||||
statusCache.instance = MainActivity.currentInstance;
|
||||
statusCache.user_id = MainActivity.currentUserID;
|
||||
|
@ -115,7 +116,7 @@ public class ContextActivity extends BaseActivity {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1663,7 +1663,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
int position = 0;
|
||||
if (statusList != null) {
|
||||
for (Status _status : statusList) {
|
||||
if (_status.id.compareTo(status.id) == 0 || (_status.reblog != null && _status.reblog.id.compareTo(status.id) == 0)) {
|
||||
if (status.id != null && ((_status.id != null && _status.id.compareTo(status.id) == 0) || (_status.reblog != null && _status.reblog.id != null && _status.reblog.id.compareTo(status.id) == 0))) {
|
||||
break;
|
||||
}
|
||||
position++;
|
||||
|
|
|
@ -512,6 +512,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
|||
@Override
|
||||
public void onDestroyView() {
|
||||
//Update last read id for home timeline
|
||||
if (isAdded()) {
|
||||
if (mLayoutManager != null) {
|
||||
int position = mLayoutManager.findFirstVisibleItemPosition();
|
||||
new Thread(() -> {
|
||||
|
@ -526,6 +527,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
|||
binding.recyclerView.setAdapter(null);
|
||||
}
|
||||
LocalBroadcastManager.getInstance(requireActivity()).unregisterReceiver(receive_action);
|
||||
}
|
||||
statusAdapter = null;
|
||||
binding = null;
|
||||
super.onDestroyView();
|
||||
|
|
Loading…
Reference in a new issue