Added check for negative font size in preferences.

This should allow to automatically recover situations like
https://github.com/arduino/Arduino/issues/6359#issuecomment-324247440

See #6359
This commit is contained in:
Cristian Maglie 2017-08-28 18:01:30 +02:00
parent 5427f94b9d
commit 7c27d09c6f
1 changed files with 2 additions and 0 deletions

View File

@ -94,6 +94,8 @@ public abstract class PreferencesHelper {
try {
// ParseDouble handle numbers with decimals too
size = (int) Double.parseDouble(split[2]);
if (size < 1) // Do not allow negative or zero size
throw new NumberFormatException();
} catch (NumberFormatException e) {
// for wrong formatted size pick the default
size = 12;