aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Bowditch <cbowditch@apache.org>2007-11-12 17:25:41 +0000
committerChris Bowditch <cbowditch@apache.org>2007-11-12 17:25:41 +0000
commite930caebf9d6879ac7845c03bf688d9568f00549 (patch)
tree6478920cd54eeb5804684d3710e36eb26743907c /src
parent0a6f26e936023197ae1b65ab2e3a2673ee1860a0 (diff)
downloadxmlgraphics-fop-e930caebf9d6879ac7845c03bf688d9568f00549.tar.gz
xmlgraphics-fop-e930caebf9d6879ac7845c03bf688d9568f00549.zip
bug fix: avoid NPE when GC has removed a weak reference in the Property Cache
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@594223 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/properties/PropertyCache.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/fo/properties/PropertyCache.java b/src/java/org/apache/fop/fo/properties/PropertyCache.java
index 22f001a07..c1f9a985c 100644
--- a/src/java/org/apache/fop/fo/properties/PropertyCache.java
+++ b/src/java/org/apache/fop/fo/properties/PropertyCache.java
@@ -273,11 +273,13 @@ public final class PropertyCache {
for (int i = table.length; --i >= 0;) {
for (CacheEntry c = table[i]; c != null; c = c.next) {
ref = c.ref;
- if ((o = ref.get()) != null) {
- hash = hash(o);
- idx = hash & newLength;
- newTable[idx] = new CacheEntry(c, newTable[idx]);
- segments[hash & SEGMENT_MASK].count++;
+ if (ref != null) {
+ if ((o = ref.get()) != null) {
+ hash = hash(o);
+ idx = hash & newLength;
+ newTable[idx] = new CacheEntry(c, newTable[idx]);
+ segments[hash & SEGMENT_MASK].count++;
+ }
}
}
}