mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-21 10:52:14 +01:00
Merge pull request #10922 from matthijskooijman/fix-no-board-null-pointer
rebuildProgrammerMenu: Handle no current board
This commit is contained in:
commit
76dfd0acc2
@ -1702,19 +1702,21 @@ public class Base {
|
|||||||
ButtonGroup group = new ButtonGroup();
|
ButtonGroup group = new ButtonGroup();
|
||||||
|
|
||||||
TargetBoard board = BaseNoGui.getTargetBoard();
|
TargetBoard board = BaseNoGui.getTargetBoard();
|
||||||
TargetPlatform boardPlatform = board.getContainerPlatform();
|
if (board != null) {
|
||||||
TargetPlatform corePlatform = null;
|
TargetPlatform boardPlatform = board.getContainerPlatform();
|
||||||
|
TargetPlatform corePlatform = null;
|
||||||
|
|
||||||
String core = board.getPreferences().get("build.core");
|
String core = board.getPreferences().get("build.core");
|
||||||
if (core != null && core.contains(":")) {
|
if (core != null && core.contains(":")) {
|
||||||
String[] split = core.split(":", 2);
|
String[] split = core.split(":", 2);
|
||||||
corePlatform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
|
corePlatform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
addProgrammersForPlatform(boardPlatform, programmerMenus, group);
|
||||||
|
if (corePlatform != null)
|
||||||
|
addProgrammersForPlatform(corePlatform, programmerMenus, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
addProgrammersForPlatform(boardPlatform, programmerMenus, group);
|
|
||||||
if (corePlatform != null)
|
|
||||||
addProgrammersForPlatform(corePlatform, programmerMenus, group);
|
|
||||||
|
|
||||||
if (programmerMenus.isEmpty()) {
|
if (programmerMenus.isEmpty()) {
|
||||||
JMenuItem item = new JMenuItem(tr("No programmers available for this board"));
|
JMenuItem item = new JMenuItem(tr("No programmers available for this board"));
|
||||||
item.setEnabled(false);
|
item.setEnabled(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user