﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
21509	New coverity issues related to comboboxes	Don-vip	team	"New defect(s) Reported-by: Coverity Scan
Showing 3 of 3 defect(s)

{{{
________________________________________________________________________________________________________
*** CID 1465234:  Null pointer dereferences  (NULL_RETURNS)
/src/org/openstreetmap/josm/gui/widgets/HistoryComboBox.java: 31 in org.openstreetmap.josm.gui.widgets.HistoryComboBox.addCurrentItemToHistory()()
25     
26         /**
27          * Adds the item in the editor to the top of the history. If the item is already present, don't
28          * add another but move it to the top. The item is then selected.
29          */
30         public void addCurrentItemToHistory() {
>>>     CID 1465234:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object ""getEditor().getItem()"".
31             String newItem = getModel().addTopElement(getEditor().getItem().toString());
32             getModel().setSelectedItem(newItem);
33         }
________________________________________________________________________________________________________
*** CID 1465233:  Null pointer dereferences  (NULL_RETURNS)
/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java: 225 in org.openstreetmap.josm.gui.tagging.presets.items.Text.getValue(java.awt.Component)()
219                 button.setBorder(BorderFactory.createEmptyBorder(insets.top, min, insets.bottom, min));
220             }
221         }
222     
223         private static String getValue(Component comp) {
224             if (comp instanceof JosmComboBox) {
>>>     CID 1465233:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object ""((org.openstreetmap.josm.gui.widgets.JosmComboBox)comp).getEditor().getItem()"".
225                 return ((JosmComboBox<?>) comp).getEditor().getItem().toString();
226             } else if (comp instanceof JosmTextField) {
227                 return ((JosmTextField) comp).getText();
228             } else if (comp instanceof JPanel) {
229                 return getValue(((JPanel) comp).getComponent(0));
230             } else {
________________________________________________________________________________________________________
*** CID 1465232:  Null pointer dereferences  (NULL_RETURNS)
/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java: 436 in org.openstreetmap.josm.gui.dialogs.properties.TagEditHelper.getEditItem(org.openstreetmap.josm.gui.tagging.ac.AutoCompComboBox)()
430          * Returns the edited item with whitespaces removed
431          * @param cb the combobox
432          * @return the edited item with whitespaces removed
433          * @since 18173
434          */
435         public static String getEditItem(AutoCompComboBox<AutoCompletionItem> cb) {
>>>     CID 1465232:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object ""cb.getEditor().getItem()"".
436             return Utils.removeWhiteSpaces(cb.getEditor().getItem().toString());
437         }
438     
439         /**
440          * Returns the selected item or the edited item as string
441          * @param cb the combobox
}}}"	defect	closed	normal	21.12	Core		fixed		marcello@…
