pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1704419 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/SetWordSpacing.java
Date Mon, 21 Sep 2015 20:33:39 GMT
Author: tilman
Date: Mon Sep 21 20:33:38 2015
New Revision: 1704419

URL: http://svn.apache.org/viewvc?rev=1704419&view=rev
Log:
PDFBOX-2982: avoid ArrayOutOfBoundsException and ClassCastException

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/SetWordSpacing.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/SetWordSpacing.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/SetWordSpacing.java?rev=1704419&r1=1704418&r2=1704419&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/SetWordSpacing.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/SetWordSpacing.java
Mon Sep 21 20:33:38 2015
@@ -37,7 +37,16 @@ public class SetWordSpacing extends Oper
     public void process(PDFOperator operator, List<COSBase> arguments)
     {
         //set word spacing
-        COSNumber wordSpacing = (COSNumber)arguments.get( 0 );
+        if (arguments.size() < 1)
+        {
+            return;
+        }
+        COSBase base = arguments.get(0);
+        if (!(base instanceof COSNumber))
+        {
+            return;
+        }
+        COSNumber wordSpacing = (COSNumber) base;
         context.getGraphicsState().getTextState().setWordSpacing( wordSpacing.floatValue()
);
     }
 



Mime
View raw message