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

NPE on Combo Box Item State Changed #4

Open
mglazer opened this issue Aug 17, 2012 · 0 comments
Open

NPE on Combo Box Item State Changed #4

mglazer opened this issue Aug 17, 2012 · 0 comments
Assignees

Comments

@mglazer
Copy link

mglazer commented Aug 17, 2012

Here's a stack trace I get quite a bit with the latest version

ERROR [AWT-EventQueue-1] com.palantir.ptoss.cinch.swing.BoundSelection - could not invoke JComboBox binding
java.lang.NullPointerException
    at com.palantir.ptoss.cinch.swing.BoundSelection$Wiring$3.itemStateChanged(BoundSelection.java:190)
    at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1205)
    at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1253)
    at javax.swing.JComboBox.contentsChanged(JComboBox.java:1309)
    at javax.swing.JComboBox.intervalRemoved(JComboBox.java:1331)
    at javax.swing.AbstractListModel.fireIntervalRemoved(AbstractListModel.java:161)
    at javax.swing.DefaultComboBoxModel.removeAllElements(DefaultComboBoxModel.java:169)
    at javax.swing.JComboBox.removeAllItems(JComboBox.java:751)

It occurs because I call remove on an empty combo box, and combo.getSelectedItem() returns null:

Object current = mutator.get();
Object newValue = combo.getSelectedItem();
if (newValue.equals(nullValue)) {

This should be changed to:

Objects.equals(newValue, nullValue)

Or something similar.

Really minor, but the error message clogs up my console.

@ghost ghost assigned dcervelli Aug 23, 2012
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

2 participants