sockeqwe / mosby

A Model-View-Presenter / Model-View-Intent library for modern Android apps
http://hannesdorfmann.com/mosby/
Apache License 2.0
5.49k stars 841 forks source link

MvpNullObjectBasePresenter inconsistent behavior #215

Closed vovkab closed 7 years ago

vovkab commented 7 years ago

I'm trying new MvpNullObjectBasePresenter from mosby3 and behavior for getView() is different now from old version.

Before it would throw NullPointerException only if view was never attached. I think this behavior is very useful, since you should attach view before you can use it. And if you attached it at least once it is not going to crash but returns proxy object.

What happens now is we always return proxy, this makes it much harder to debug. Since it will look like everything is fine, even though you never called attachView().

sockeqwe commented 7 years ago

Thanks for reporting. In upcoming 3.0 release a IllegalStateException will be thrown if no view has ever been attached before.