Skip to content

Commit

Permalink
Fix loading of JabRef 5.0 font preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Apr 22, 2020
1 parent 5b5f6b7 commit 7c260f5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/org/jabref/migrations/PreferencesMigrations.java
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,14 @@ static void restoreVariablesForBackwardCompatibility(JabRefPreferences preferenc
}

// Ensure font size is a parsable int variable
preferences.putInt(JabRefPreferences.MAIN_FONT_SIZE,
(int) Math.round(Double.parseDouble(preferences.get(JabRefPreferences.MAIN_FONT_SIZE))));
try {
// some versions stored the font size as double to the **same** key
// since the preference store is type-safe, we need to add this workaround
String fontSizeAsString = preferences.get(JabRefPreferences.MAIN_FONT_SIZE);
int fontSizeAsInt = (int) Math.round(Double.parseDouble(fontSizeAsString));
preferences.putInt(JabRefPreferences.MAIN_FONT_SIZE, fontSizeAsInt);
} catch (ClassCastException e) {
// already an integer
}
}
}

0 comments on commit 7c260f5

Please sign in to comment.