@@ -310,11 +310,19 @@ public static List<BoardDescription> makeBoardDescriptors(File boardFile) {
310
310
311
311
public BoardDescription () {
312
312
File boardsFile = new File (myStorageNode .get (KEY_LAST_USED_BOARDS_FILE , EMPTY ));
313
- myBoardTxtFile = new BoardTxtFile (boardsFile );
314
- myBoardID = myStorageNode .get (KEY_LAST_USED_BOARD , EMPTY );
315
- myUploadPort = myStorageNode .get (KEY_LAST_USED_UPLOAD_PORT , EMPTY );
316
- myProgrammer = myStorageNode .get (KEY_LAST_USED_UPLOAD_PROTOCOL , EMPTY );
317
- myOptions = KeyValue .makeMap (myStorageNode .get (KEY_LAST_USED_BOARD_MENU_OPTIONS , EMPTY ));
313
+ if (!boardsFile .exists ()) {
314
+ List <ArduinoPlatformVersion > platforms = BoardsManager .getInstalledPlatforms ();
315
+ //If you crash on the next line no platform have been installed
316
+ ArduinoPlatformVersion platform = platforms .get (0 );
317
+ myBoardTxtFile = new BoardTxtFile (platform .getBoardsFile ());
318
+ myBoardID = myBoardTxtFile .getAllBoardIDs ().get (0 );
319
+ } else {
320
+ myBoardTxtFile = new BoardTxtFile (boardsFile );
321
+ myBoardID = myStorageNode .get (KEY_LAST_USED_BOARD , EMPTY );
322
+ myUploadPort = myStorageNode .get (KEY_LAST_USED_UPLOAD_PORT , EMPTY );
323
+ myProgrammer = myStorageNode .get (KEY_LAST_USED_UPLOAD_PROTOCOL , EMPTY );
324
+ myOptions = KeyValue .makeMap (myStorageNode .get (KEY_LAST_USED_BOARD_MENU_OPTIONS , EMPTY ));
325
+ }
318
326
}
319
327
320
328
public BoardDescription (BoardDescription srcObject ) {
0 commit comments