Skip to content

Commit 4ae740a

Browse files
committed
PluggableDiscovery: BoardPort.label sanity check in the correct place
1 parent 4c188c9 commit 4ae740a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arduino-core/src/cc/arduino/packages/discoverers/PluggableDiscovery.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ private void processJsonNode(ObjectMapper mapper, JsonNode node) {
173173
private BoardPort mapJsonNodeToBoardPort(ObjectMapper mapper, JsonNode node) {
174174
try {
175175
BoardPort port = mapper.treeToValue(node.get("port"), BoardPort.class);
176+
// if no label, use address
177+
if (port.getLabel() == null || port.getLabel().isEmpty()) {
178+
port.setLabel(port.getAddress());
179+
}
176180
port.searchMatchingBoard();
177181
return port;
178182
} catch (JsonProcessingException e) {
@@ -256,10 +260,6 @@ private synchronized void addOrUpdate(BoardPort port) {
256260
// if address already on the list, discard old info
257261
portList.removeIf(bp -> address.equals(bp.getAddress()));
258262

259-
// if no label, use address
260-
if (port.getLabel() == null) {
261-
port.setLabel(address);
262-
}
263263
portList.add(port);
264264
}
265265

0 commit comments

Comments
 (0)