NetworkDiscovery was silently failing because packages werenìt ready yet. Fixes #2837

This commit is contained in:
Federico Fissore 2015-04-13 13:29:05 +02:00
parent b42c6667e1
commit 40535dfc55
2 changed files with 3 additions and 1 deletions

View File

@ -137,7 +137,7 @@ public class NetworkDiscovery implements Discovery, ServiceListener, cc.arduino.
}
String label = name + " at " + address;
if (board != null) {
if (board != null && BaseNoGui.packages != null) {
String boardName = BaseNoGui.getPlatform().resolveDeviceByBoardID(BaseNoGui.packages, board);
if (boardName != null) {
label += " (" + boardName + ")";

View File

@ -164,6 +164,8 @@ public class Platform {
}
public String resolveDeviceByBoardID(Map<String, TargetPackage> packages, String boardId) {
assert packages != null;
assert boardId != null;
for (TargetPackage targetPackage : packages.values()) {
for (TargetPlatform targetPlatform : targetPackage.getPlatforms().values()) {
for (TargetBoard board : targetPlatform.getBoards().values()) {