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

FIX Null Pointer Exception #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

andypower
Copy link

When you try to use the method getCalendarEventId(...) and the parent class returns null for getDesktop() the NPE is thrown.
I added a simple check to avoid to throw NPE and few loc to generate a random UUID in case of lack of the Desktop Object.

When you try to use the method getCalendarEventId(...) and the parent class returns null for getDesktop() the NPE is thrown.
I added a simple check to avoid to throw NPE and few loc to generate a random UUID in case of lack of Desktop Object.
@hawkchen
Copy link
Member

Thanks for your effort. Normally, if the desktop is null, that means the component is not attached on a page. Could you provide a reproducible example about how do you encounter NPE?

@andypower
Copy link
Author

Yes, you are right, the page must not be null if the component is attached but in my case I had a lot of NPE using the popup calendar component.
Attached there are the files that I use. The issue happens after pressing the "Salva" (save) button on the popupCalendario.zul component. After it closes the pup-up the NPE appears but not everytime I use it. I was not capable to determine the difference between executions. Maybe a race condition issue?
I use a viewmodel instead that a controller and I use the queue to manage the events. The only way I found to avoid NPEs was to add the if clause on your code
classes.zip

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

Successfully merging this pull request may close these issues.

2 participants