Skip to content

Commit 97b0911

Browse files
committed
Do not fail if the data folder can't be read
Fix arduino#7937
1 parent 53faeda commit 97b0911

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import java.util.*;
5656
import java.util.stream.Collectors;
5757

58+
import static processing.app.I18n.format;
5859
import static processing.app.I18n.tr;
5960
import static processing.app.helpers.filefilters.OnlyDirs.ONLY_DIRS;
6061

@@ -100,13 +101,17 @@ public void parseIndex() throws Exception {
100101
// Overlay 3rd party indexes
101102
File[] indexFiles = preferencesFolder.listFiles(new TestPackageIndexFilenameFilter(new PackageIndexFilenameFilter(Constants.DEFAULT_INDEX_FILE_NAME)));
102103

103-
for (File indexFile : indexFiles) {
104-
try {
105-
mergeContributions(indexFile);
106-
} catch (JsonProcessingException e) {
107-
System.err.println(I18n.format(tr("Skipping contributed index file {0}, parsing error occured:"), indexFile));
108-
System.err.println(e);
104+
if (indexFiles != null) {
105+
for (File indexFile : indexFiles) {
106+
try {
107+
mergeContributions(indexFile);
108+
} catch (JsonProcessingException e) {
109+
System.err.println(format(tr("Skipping contributed index file {0}, parsing error occured:"), indexFile));
110+
System.err.println(e);
111+
}
109112
}
113+
} else {
114+
System.err.println(format(tr("Error reading package indexes folder: {0}\n(maybe a permission problem?)"), preferencesFolder));
110115
}
111116

112117
// Fill tools and toolsDependency cross references

0 commit comments

Comments
 (0)