Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with NPE in AddToEndSingleStrategy.java line 25 #219

Open
tridetch opened this issue Aug 11, 2018 · 7 comments
Open

Crash with NPE in AddToEndSingleStrategy.java line 25 #219

tridetch opened this issue Aug 11, 2018 · 7 comments

Comments

@tridetch
Copy link

Есть большая вью с примерно 80 методами в какой то момент в крэшлитике стал приходить такой крэш и появляется все чаще и чаще

AddToEndSingleStrategy.java line 25
com.arellomobile.mvp.viewstate.strategy.AddToEndSingleStrategy.beforeApply

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
at com.arellomobile.mvp.viewstate.strategy.AddToEndSingleStrategy.beforeApply(AddToEndSingleStrategy.java:25)
at com.arellomobile.mvp.viewstate.ViewCommands.beforeApply(ViewCommands.java:27)
at online.cartrek.app.presentation.view.MapView$$State.updateAbonentTime(MapView$$State.java:1217)
at online.cartrek.app.presentation.presenter.MapPresenter$4.run(MapPresenter.java:294)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)

Moxy version 1.5.3

@tridetch
Copy link
Author

И еще такие крэши

AddToEndSingleStrategy.java line 31
com.arellomobile.mvp.viewstate.strategy.AddToEndSingleStrategy.beforeApply

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=15; index=15
at java.util.ArrayList.add(ArrayList.java:468)
at com.arellomobile.mvp.viewstate.strategy.AddToEndSingleStrategy.beforeApply(AddToEndSingleStrategy.java:31)
at com.arellomobile.mvp.viewstate.ViewCommands.beforeApply(ViewCommands.java:27)
at online.cartrek.app.presentation.view.MapView$$State.triggeredDistance(MapView$$State.java:1169)
at online.cartrek.app.presentation.presenter.MapPresenter$3.run(MapPresenter.java:256)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)

@VovaStelmashchuk
Copy link
Contributor

VovaStelmashchuk commented Aug 16, 2018

@tridetch Can you provide View interface (Maybe you can create gist page), without implementation )

@tridetch
Copy link
Author

@VovaStelmashchuk
Copy link
Contributor

@tridetch Do you have some problems with the version 1.5.5? Or another way of this question, Why you do not use 1.5.5?

@tridetch
Copy link
Author

@jordan1997 Yes, im update moxy to version 1.5.5 but unfortunately it did not help

@VovaStelmashchuk
Copy link
Contributor

VovaStelmashchuk commented Aug 21, 2018

@tridetch I created following project based on your interface
https://github.com/jordan1997/MoxyBigView

And I cannot reproduce the bug. I added a test into that project which rotates the device 500 times, and nothing happens.

I think it happens because of some of the view detach, by Set doesn't update immediately. For my opinion problem in the following lines:

        protected ViewCommands<View> mViewCommands = new ViewCommands<>();
	protected Set<View> mViews;
	protected Set<View> mInRestoreState;
	protected Map<View, Set<ViewCommand<View>>> mViewStates;

Maybe, we need to use volatile for following fields. @senneco What do you think about this?

@tridetch Maybe, you can make some changes in my sample project, for reproducing your issue.

@formatBCE
Copy link

I have same issue. At some point, i have a lot of updates using one of view methods with AddToEndSingleStrategy. No rotations or any other view detaches on that point, but still crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants