There are 20 different places where the cast ((ODKView) currentView) occurs in FormEntryActivity. Some of these have an instanceof check before, some have a null check before, some have both, and some have neither.
This variable is only ever set to the result of createView. There are paths through createView that return non ODKView objects and null.
I propose hiding the currentView access behind an @Nullable getter, checking for the correct type, and returning null if the currentView is not ODKView. At the call site, we can replace the direct attribute access with null check calls to this method.
I agree we should refactor this part of code and btw it would be greate if we can change that name...
ODKView why? Does it sound strange to anyone else? Maybe SurveyView or FormView?
@jknightco the proposed change sounds great.
@grzesiek2010 I'm not necessarily opposed to that but I think it's a separate question!
Hello @grzesiek2010 @lognaturel I will like to look into this issue.
Fantastic, thanks @icemc! For issues that don't need discussion you can simply comment opendatakit-bot claim and it will be yours. 馃槉
opendatakit-bot claim
Ahhh, I'm sorry. You need the @ in front of the bot name to get its attention.
yeah forgot about that too
@opendatakit-bot claim
Welcome to Open Data Kit, @icemc! We just sent you an invite to collaborate on this repository at https://github.com/opendatakit/collect/invitations. Please accept this invite in order to claim this issue and begin a fun and rewarding experience contributing to Open Data Kit!
Here are some tips to get you off to a good start:
See you on the other side (that is, the pull request side)!
Thank you Mr. @opendatakit-bot. 馃ぃ馃ぃ
Most helpful comment
Thank you Mr. @opendatakit-bot. 馃ぃ馃ぃ