-
Notifications
You must be signed in to change notification settings - Fork 28
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
null @Parcel @Extra throws exception #208
Comments
Hey @justincpollard! I was able to reproduce this and a fix would be pretty straight foward. Are you guys working off of this branch: #196? |
Hey John! We're actually using |
^ That should do the trick. Could you try it out? |
Hey John, I'll try to take a look next week; off on a brief weekend vacation. Thanks for looking into this :-) |
Cool, thanks for reporting the issue. Let me know when you get back around to it. |
Hey John, sorry I never got to this :-( I've been head down for the past 2 months on a feature we're releasing this week. |
Quite alright. I've done quite a bit of testing around this feature and it was about time to clean up the open PRs. Of course, let me know if you have any issues. |
I'm trying to pass an
@Parcel
annotated@Extra
into my activity like so:The
DetailModel
class is annotated with@Parcel
from your Parceler library.Since this param is optional, sometimes it will be null. Unfortunately, when it is null, the app crashes with this exception:
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object org.parceler.ParcelWrapper.getParcel()' on a null object reference
It looks like the generated code doesn't take into account that a
@Parcel
could be null; it callsParcelWrapper.getParcel()
anyway:((DetailModel)((ParcelWrapper) ExtraUtil.getExtra(this.getIntent().getExtras(), "theParcel", true)).getParcel())
The text was updated successfully, but these errors were encountered: