Skip to content

Commit

Permalink
TIKA-4337 -- check for empty string in array index 1 (#2109)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9a6bda5)
  • Loading branch information
tballison committed Jan 28, 2025
1 parent 91ba3d6 commit 5120b21
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.sax.XHTMLContentHandler;
import org.apache.tika.utils.StringUtils;


/**
Expand Down Expand Up @@ -247,10 +248,10 @@ private List<GlyphIndex> parseIndicesString(String indicesString) throws SAXExce
for (String indexString : indicesString.split(";", -1)) {
// We only want to extract the advance which will be the second comma separated value
String[] commaSplit = indexString.split(",", -1);
if (commaSplit.length < 2) {
if (commaSplit.length < 2 || StringUtils.isBlank(commaSplit[1])) {
indices.add(new GlyphIndex(0.0f));
} else {
// Advance is measured in hundreths so divide by 100
// Advance is measured in hundredths so divide by 100
float advance = Float.parseFloat(commaSplit[1]) / 100.0f;
indices.add(new GlyphIndex(advance));
}
Expand Down

0 comments on commit 5120b21

Please sign in to comment.