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 2026/10/11 10:27:40 UTC
svn commit: r1939022 - pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common
Author: tilman
Date: Sun Oct 11 10:27:39 2026
New Revision: 1939022
Log:
PDFBOX-5660: Sonar fix, avoid NPE
Modified:
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java
Modified: pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java
==============================================================================
--- pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java Sun Oct 11 10:27:37 2026 (r1939021)
+++ pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java Sun Oct 11 10:27:39 2026 (r1939022)
@@ -91,12 +91,16 @@ public class PDRange implements COSObjec
/**
* This will get the minimum value of the range.
*
- * @return The min value.
+ * @return The min value or 0 in case of error.
*/
public float getMin()
{
- COSNumber min = (COSNumber)rangeArray.getObject( startingIndex*2 );
- return min.floatValue();
+ COSBase base = rangeArray.getObject(startingIndex * 2);
+ if (base instanceof COSNumber)
+ {
+ return ((COSNumber) base).floatValue();
+ }
+ return 0;
}
/**
@@ -112,12 +116,16 @@ public class PDRange implements COSObjec
/**
* This will get the maximum value of the range.
*
- * @return The max value.
+ * @return The max value or 0 in case of error.
*/
public float getMax()
{
- COSNumber max = (COSNumber)rangeArray.getObject( startingIndex*2+1 );
- return max.floatValue();
+ COSBase base = rangeArray.getObject(startingIndex * 2 + 1);
+ if (base instanceof COSNumber)
+ {
+ return ((COSNumber) base).floatValue();
+ }
+ return 0;
}
/**