]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
bug fix: avoid NPE when GC has removed a weak reference in the Property Cache
authorChris Bowditch <cbowditch@apache.org>
Mon, 12 Nov 2007 17:25:41 +0000 (17:25 +0000)
committerChris Bowditch <cbowditch@apache.org>
Mon, 12 Nov 2007 17:25:41 +0000 (17:25 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@594223 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/properties/PropertyCache.java

index 22f001a0716d7d97aa110726435f82ce1cff561e..c1f9a985c6dd41f6f0eca92ff92f465e37bb79d4 100644 (file)
@@ -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++;
+                                }
                             }
                         }
                     }