Skip to content

Commit

Permalink
Don't blindly cast children to FontEntityAtom
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@405381 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Gagravarr committed May 9, 2006
1 parent e626f3e commit f80d4ea
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
Expand Up @@ -38,13 +38,17 @@ protected FontCollection(byte[] source, int start, int len) {
System.arraycopy(source,start,_header,0,8);

_children = Record.findChildRecords(source,start+8,len-8);
// Save font names into <code>List</code>
fonts = new ArrayList();
for (int i = 0; i < _children.length; i++){
FontEntityAtom atom = (FontEntityAtom)_children[i];
fonts.add(atom.getFontName());
}

// Save font names into <code>List</code>
fonts = new ArrayList();
for (int i = 0; i < _children.length; i++){
if(_children[i] instanceof FontEntityAtom) {
FontEntityAtom atom = (FontEntityAtom)_children[i];
fonts.add(atom.getFontName());
} else {
System.err.println("Warning: FontCollection child wasn't a FontEntityAtom, was " + _children[i]);
}
}
}

/**
Expand Down

0 comments on commit f80d4ea

Please sign in to comment.