AstroImageJ / astroimagej

http://astroimagej.com
GNU General Public License v3.0
13 stars 10 forks source link

Potential API usage risk of getSelection() in the project #60

Open Gao-Chuan opened 7 months ago

Gao-Chuan commented 7 months ago

Hi folks,

We've observed that in the API call to ButtonModel javax.swing.ButtonGroup.getSelection(), there seems to be a missing check for a return value, which could potentially lead to a NullPointerException. This issue is evident in the code at the following link:

code link1

code link2

code link3

code link4

code link5

Specifically, as noted in the library's documentation on line 140, the return value of this method can be null if no button has been selected:

@return the currently selected button model, null if none was selected yet

For further reference, please see the line 140 of the library code at this link.

Best wishes, 1phan