Browse Source

Simplified code to avoid NullPointerException when server response arrives after the view was unbound.

Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Dariusz Olszewski 3 năm trước cách đây
mục cha
commit
d064ad3f65

+ 1 - 1
app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java

@@ -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;
                     }

+ 0 - 4
app/src/main/java/com/nextcloud/talk/controllers/base/ButterKnifeController.kt

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