Skip to content

Commit e360f82

Browse files
committed
Fixed incorrect boards.txt preference handling when submenu id has underscore
Fixes #2533
1 parent 379df90 commit e360f82

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

arduino-core/src/processing/app/BaseNoGui.java

+14-5
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,27 @@ static public PreferencesMap getBoardPreferences() {
154154
TargetBoard board = getTargetBoard();
155155
if (board == null)
156156
return null;
157+
String boardId = board.getId();
157158

158159
PreferencesMap prefs = new PreferencesMap(board.getPreferences());
160+
161+
String extendedName = prefs.get("name");
159162
for (String menuId : board.getMenuIds()) {
163+
if (!board.hasMenu(menuId))
164+
continue;
165+
166+
// Get "custom_[MENU_ID]" preference (for example "custom_cpu")
160167
String entry = PreferencesData.get("custom_" + menuId);
161-
if (board.hasMenu(menuId) && entry != null &&
162-
entry.startsWith(board.getId())) {
163-
String selectionId = entry.substring(entry.indexOf("_") + 1);
168+
if (entry != null && entry.startsWith(boardId)) {
169+
170+
String selectionId = entry.substring(boardId.length() + 1);
164171
prefs.putAll(board.getMenuPreferences(menuId, selectionId));
165-
prefs.put("name", prefs.get("name") + ", " +
166-
board.getMenuLabel(menuId, selectionId));
172+
173+
// Update the name with the extended configuration
174+
extendedName += ", " + board.getMenuLabel(menuId, selectionId);
167175
}
168176
}
177+
prefs.put("name", extendedName);
169178
return prefs;
170179
}
171180

0 commit comments

Comments
 (0)