mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-22 13:09:46 +01:00
Avoid NullPointerException when server response arrives after the view was unbound.
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
This commit is contained in:
parent
505bcdfe20
commit
606c6b0b9e
@ -525,6 +525,14 @@ public class ConversationsListController extends BaseController implements Searc
|
||||
.subscribe(roomsOverall -> {
|
||||
Log.d(TAG, "fetchData - getRooms - got response: " + startNanoTime);
|
||||
|
||||
// This is invoked asynchronously, when server returns a response the view might have been
|
||||
// unbound in the meantime. Check if the view is still there.
|
||||
// FIXME - does it make sense to update internal data structures even when view has been unbound?
|
||||
if (!viewIsBound()) {
|
||||
Log.d(TAG, "fetchData - getRooms - view is not bound: " + startNanoTime);
|
||||
return;
|
||||
}
|
||||
|
||||
if (adapterWasNull) {
|
||||
adapterWasNull = false;
|
||||
loadingContent.setVisibility(View.GONE);
|
||||
|
@ -55,4 +55,8 @@ abstract class ButterKnifeController : Controller {
|
||||
unbinder!!.unbind()
|
||||
unbinder = null
|
||||
}
|
||||
|
||||
protected fun viewIsBound() : Boolean {
|
||||
return unbinder != null
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user