Skip to content

Commit 0c950cd

Browse files
committed
Read preferences txt, if fails, read defaults, else really break
1 parent 2bea632 commit 0c950cd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/src/processing/app/Preferences.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,15 @@ static public void setBoolean(String attribute, boolean value) {
336336

337337

338338
static public int getInteger(String attribute /*, int defaultValue*/) {
339-
return Integer.parseInt(get(attribute));
339+
try {
340+
return Integer.parseInt(get(attribute));
341+
} catch (NumberFormatException err) {
342+
try {
343+
return Integer.parseInt(getDefault(attribute));
344+
} catch (NumberFormatException err2) {
345+
throw new IllegalArgumentException("Cannot parse: " + attribute);
346+
}
347+
}
340348
}
341349

342350

0 commit comments

Comments
 (0)