Simplified code to 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:
Dariusz Olszewski 2022-02-20 17:02:14 +01:00 committed by Marcel Hibbe
parent 606c6b0b9e
commit d064ad3f65
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
2 changed files with 1 additions and 5 deletions

View File

@ -528,7 +528,7 @@ public class ConversationsListController extends BaseController implements Searc
// 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()) {
if (getView() == null) {
Log.d(TAG, "fetchData - getRooms - view is not bound: " + startNanoTime);
return;
}

View File

@ -55,8 +55,4 @@ abstract class ButterKnifeController : Controller {
unbinder!!.unbind()
unbinder = null
}
protected fun viewIsBound() : Boolean {
return unbinder != null
}
}