You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2015/09/21 21:34:07 UTC

svn commit: r1704404 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/MoveTextSetLeading.java

Author: tilman
Date: Mon Sep 21 19:34:07 2015
New Revision: 1704404

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

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

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/MoveTextSetLeading.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/MoveTextSetLeading.java?rev=1704404&r1=1704403&r2=1704404&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/MoveTextSetLeading.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/operator/MoveTextSetLeading.java Mon Sep 21 19:34:07 2015
@@ -43,7 +43,16 @@ public class MoveTextSetLeading extends
     public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
     {
         //move text position and set leading
-        COSNumber y = (COSNumber)arguments.get( 1 );
+        if (arguments.size() < 2)
+        {
+            return;
+        }
+        COSBase base1 = arguments.get(1);
+        if (!(base1 instanceof COSNumber))
+        {
+            return;
+        }
+        COSNumber y = (COSNumber) base1;
 
         ArrayList<COSBase> args = new ArrayList<COSBase>();
         args.add(new COSFloat(-1*y.floatValue()));