Skip to content

Commit be9273e

Browse files
author
taylor.smock
committed
Fix #23023: Fix logic for enabling buttons in color preferences (patch by Larsossum)
This makes the buttons work properly with the filterfield. git-svn-id: https://josm.openstreetmap.de/svn/trunk@18781 0c6e7542-c601-0410-84e7-c038aed88b3b
1 parent dc6ea63 commit be9273e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,12 @@ public void tableChanged(TableModelEvent e) {
441441

442442
private void updateEnabledState() {
443443
int sel = colors.getSelectedRow();
444-
if (sel < 0 || sel >= colors.getRowCount()) {
445-
return;
444+
ColorEntry ce;
445+
if (sel >= 0 && sel < colors.getRowCount()) {
446+
ce = (ColorEntry) colors.getValueAt(sel, 0);
447+
} else {
448+
ce = null;
446449
}
447-
ColorEntry ce = (ColorEntry) colors.getValueAt(sel, 0);
448450
remove.setEnabled(ce != null && isRemoveColor(ce));
449451
colorEdit.setEnabled(ce != null);
450452
defaultSet.setEnabled(ce != null && !ce.isDefault());

0 commit comments

Comments
 (0)