From 1ce9aa9e1c4e927337c01e564ba168ef8d3e5e7e Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Thu, 23 Feb 2023 12:15:27 -0700 Subject: [PATCH] Fix #22765: IAE when sending a null license Signed-off-by: Taylor Smock --- .../mapwithai/MapWithAIProvidersPanel.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/mapwithai/MapWithAIProvidersPanel.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/mapwithai/MapWithAIProvidersPanel.java index 44d34ab7..032a8dbe 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/mapwithai/MapWithAIProvidersPanel.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/mapwithai/MapWithAIProvidersPanel.java @@ -187,19 +187,6 @@ private static class MapWithAITableCellRenderer extends DefaultTableCellRende @SuppressWarnings("unchecked") public final Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - // See #22740 - if (value == null) { - final StringBuilder message = new StringBuilder(); - for (int tableRow = 0; tableRow < table.getRowCount(); tableRow++) { - message.append('|'); - for (int tableCol = 0; tableCol < table.getColumnCount(); tableCol++) { - final Object tableVal = table.getValueAt(tableRow, tableCol); - message.append(tableVal).append('|'); - } - message.append(System.lineSeparator()); - } - throw new IllegalArgumentException("value was null:" + System.lineSeparator() + message); - } T obj = (T) value; JLabel label = (JLabel) super.getTableCellRendererComponent(table, mapper.apply(obj), isSelected, hasFocus, row, column); @@ -208,7 +195,7 @@ public final Component getTableCellRendererComponent(JTable table, Object value, GuiHelper.setBackgroundReadable(label, defaultColor); GuiHelper.setBackgroundReadable(label, isSelected ? selectedColor : defaultColor); - if (this.highlightIfActive) { + if (this.highlightIfActive && obj != null) { MapWithAIInfo info = obj instanceof MapWithAIInfo ? (MapWithAIInfo) obj : reverseMapper.apply(obj); if (info == null) { GuiHelper.setBackgroundReadable(label, defaultColor);