Skip to content

Commit

Permalink
Fixed NPE when overriding font size of non-ttf font with inline style.
Browse files Browse the repository at this point in the history
  • Loading branch information
shannah committed Sep 21, 2017
1 parent e150ae7 commit 863092a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions CodenameOne/src/com/codename1/ui/plaf/StyleParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2180,11 +2180,18 @@ public void setFile(String file) {
*/
public Font createFont(Style baseStyle) {
Font f = name == null ? baseStyle.getFont() : Font.createTrueTypeFont(name, file);
if (f == null) {
if (f == null || (getSize() != null && !f.isTTFNativeFont())) {
f = Font.createTrueTypeFont(Font.NATIVE_MAIN_REGULAR, Font.NATIVE_MAIN_REGULAR);

}
return f.derive(getSizeInPixels(baseStyle), f.getStyle());
if (f != null) {
if (f.isTTFNativeFont()) {
return f.derive(getSizeInPixels(baseStyle), f.getStyle());
} else {
return Font.getDefaultFont();
}
} else {
return Font.getDefaultFont();
}
}
}

Expand Down

0 comments on commit 863092a

Please sign in to comment.