Skip to content

Commit aaf9dee

Browse files
glenn.volckaertUbuntu
authored andcommitted
Adds proper handling of empty properties in CssFontFaceRule
DEVSIX-6339
1 parent 32b7cef commit aaf9dee

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

styled-xml-parser/src/main/java/com/itextpdf/styledxmlparser/css/CssFontFaceRule.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ public CssFontFaceRule() {
7171
* @return the properties
7272
*/
7373
public List<CssDeclaration> getProperties() {
74-
return new ArrayList<>(properties) ;
74+
if (properties==null) {
75+
return new ArrayList<>();
76+
}
77+
return new ArrayList<>(properties);
7578
}
7679

7780
/* (non-Javadoc)
@@ -89,7 +92,7 @@ public void addBodyCssDeclarations(List<CssDeclaration> cssDeclarations) {
8992
public String toString() {
9093
StringBuilder sb = new StringBuilder();
9194
sb.append("@").append(getRuleName()).append(" {").append("\n");
92-
for (CssDeclaration declaration : properties) {
95+
for (CssDeclaration declaration : getProperties()) {
9396
sb.append(" ");
9497
sb.append(declaration);
9598
sb.append(";\n");

styled-xml-parser/src/main/java/com/itextpdf/styledxmlparser/css/parse/syntax/CssParserStateController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ void storeSemicolonAtRule() {
344344
void finishAtRuleBlock() {
345345
List<CssDeclaration> storedProps = storedPropertiesWithoutSelector.pop();
346346
CssNestedAtRule atRule = nestedAtRules.pop();
347-
if (isCurrentRuleSupported) {
347+
if (isCurrentRuleSupported ) {
348348
processFinishedAtRuleBlock(atRule);
349349
if (!storedProps.isEmpty()) {
350350
atRule.addBodyCssDeclarations(storedProps);

0 commit comments

Comments
 (0)