mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-21 15:54:39 +01:00
PluggableDiscovery: BoardPort.label sanity check in the correct place
This commit is contained in:
parent
4c188c9374
commit
4ae740ad66
@ -173,6 +173,10 @@ public class PluggableDiscovery implements Discovery {
|
|||||||
private BoardPort mapJsonNodeToBoardPort(ObjectMapper mapper, JsonNode node) {
|
private BoardPort mapJsonNodeToBoardPort(ObjectMapper mapper, JsonNode node) {
|
||||||
try {
|
try {
|
||||||
BoardPort port = mapper.treeToValue(node.get("port"), BoardPort.class);
|
BoardPort port = mapper.treeToValue(node.get("port"), BoardPort.class);
|
||||||
|
// if no label, use address
|
||||||
|
if (port.getLabel() == null || port.getLabel().isEmpty()) {
|
||||||
|
port.setLabel(port.getAddress());
|
||||||
|
}
|
||||||
port.searchMatchingBoard();
|
port.searchMatchingBoard();
|
||||||
return port;
|
return port;
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
@ -256,10 +260,6 @@ public class PluggableDiscovery implements Discovery {
|
|||||||
// if address already on the list, discard old info
|
// if address already on the list, discard old info
|
||||||
portList.removeIf(bp -> address.equals(bp.getAddress()));
|
portList.removeIf(bp -> address.equals(bp.getAddress()));
|
||||||
|
|
||||||
// if no label, use address
|
|
||||||
if (port.getLabel() == null) {
|
|
||||||
port.setLabel(address);
|
|
||||||
}
|
|
||||||
portList.add(port);
|
portList.add(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user