bugfix NPE on start-up with not opened project

This commit is contained in:
rusefi 2020-08-16 20:26:12 -04:00
parent 522baf3ce8
commit e91303f16b
1 changed files with 9 additions and 3 deletions

View File

@ -52,8 +52,16 @@ public class LogUploadSelector {
private void refresh() {
fileList.removeAll();
String folder = getLogsFolderDir(controllerAccessSupplier.get().getEcuConfigurationNames()[0]);
String[] ecuConfigurationNames = controllerAccessSupplier.get().getEcuConfigurationNames();
if (ecuConfigurationNames != null && ecuConfigurationNames.length > 0) {
String folder = getLogsFolderDir(ecuConfigurationNames[0]);
processFolder(folder);
}
AutoupdateUtil.trueLayout(content);
}
private void processFolder(String folder) {
for (String fileName : Objects.requireNonNull(new File(folder).list((dir, name) -> name.endsWith(".mlg")))) {
JPanel panel = new JPanel(new FlowLayout());
JButton delete = new JButton("Delete");
@ -103,8 +111,6 @@ public class LogUploadSelector {
panel.add(new JLabel(fileName));
fileList.add(panel);
}
AutoupdateUtil.trueLayout(content);
}
@NotNull