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

This small fix solves a NPE in cases in which a look&feel has been set. #10

Merged
merged 2 commits into from
Jul 7, 2016

Conversation

moovida
Copy link
Contributor

@moovida moovida commented Jun 30, 2016

This small fix solves a NPE in cases in which a look&feel has been set.

I am not sure if this is enough though. It seems to work properly.

java.lang.NullPointerException at gov.nasa.worldwind.awt.WorldWindowGLJPanel.addPropertyChangeListener(WorldWindowGLJPanel.java:371) at javax.swing.plaf.synth.SynthPanelUI.installListeners(SynthPanelUI.java:83) at javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:63) at javax.swing.JComponent.setUI(JComponent.java:666) at javax.swing.JPanel.setUI(JPanel.java:153) at javax.swing.JPanel.updateUI(JPanel.java:126) at javax.swing.JPanel.<init>(JPanel.java:86) at javax.swing.JPanel.<init>(JPanel.java:109) at javax.swing.JPanel.<init>(JPanel.java:117) at javax.media.opengl.awt.GLJPanel.<init>(GLJPanel.java:349) at gov.nasa.worldwind.awt.WorldWindowGLJPanel.<init>(WorldWindowGLJPanel.java:63)

@zglueck
Copy link
Contributor

zglueck commented Jul 6, 2016

Thanks for identifying and purposing the change to this issue. The WorldWind team would like to incorporate the change. Before merging your pull request, will you format the code to match the existing WorldWind Java? An example of the conventional if statement spacing is on line 211 of the same file. Additionally, will you please add a comment (again following the convention of the project e.g. //) with a short explanation of the change? Your comment "solves NPE in cases in which a look and feel has been set" would probably work unless you had more to add.

Thanks for making World Wind Java better! If you've got any questions feel free to ask me here or on the forums.

@moovida
Copy link
Contributor Author

moovida commented Jul 7, 2016

Thanks @zglueck , I fixed spacing and documentation.
I was in doubt whether I should add the same check also to the other xxxPropertyChangeListener methods, but decided not to, because in "normal" conditions the wwd object should really be available already. What do you think?

@zglueck
Copy link
Contributor

zglueck commented Jul 7, 2016

I agree with your analysis. As we are only encountering this issue when setting a look and feel I think it is best to constrain changes to the method in question. Thanks again for your work!

@zglueck zglueck merged commit 7c57ba5 into NASAWorldWind:master Jul 7, 2016
@pdavidc pdavidc added the bug label Dec 9, 2016
@pdavidc pdavidc added this to the v2.1.0 milestone Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants