diff --git a/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java b/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java
index ef5dc6e66b..17b2d0815e 100644
|
a
|
b
|
public class PresetListEntry implements Comparable<PresetListEntry> {
|
| 188 | 188 | * @return see above |
| 189 | 189 | */ |
| 190 | 190 | public int getCount() { |
| 191 | | Integer count = cms == null ? null : cms.usage.map.get(value); |
| | 191 | Integer count = cms == null || cms.usage == null ? null : cms.usage.map.get(value); |
| 192 | 192 | return count == null ? 0 : count; |
| 193 | 193 | } |
| 194 | 194 | |
diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntryTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntryTest.java
index 1c2827878c..0555ba6ca1 100644
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.gui.tagging.presets.items; |
| 3 | 3 | |
| | 4 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| 4 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 5 | 6 | |
| 6 | 7 | import org.junit.jupiter.api.BeforeAll; |
| … |
… |
class PresetListEntryTest {
|
| 27 | 28 | void testTicket12416() { |
| 28 | 29 | assertTrue(new PresetListEntry("", null).getListDisplay(200).contains(" ")); |
| 29 | 30 | } |
| | 31 | |
| | 32 | /** |
| | 33 | * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/21550">#21550</a> |
| | 34 | */ |
| | 35 | @Test |
| | 36 | void testTicket21550() { |
| | 37 | final PresetListEntry entry = new PresetListEntry("", new Combo()); |
| | 38 | assertDoesNotThrow(entry::getCount); |
| | 39 | } |
| 30 | 40 | } |