@@ -670,26 +670,28 @@ void computeReferences() {
670670 if (tag == INSTANCE_DUMP ) {
671671 long classId = dumpBuffer .getID (start +1 +idSize +4 );
672672 ClassDump classDump = (ClassDump ) classIdToClassMap .get (new Long (classId ));
673- long instanceId = dumpBuffer .getID (start +1 );
674- long inOff = start +1 +idSize +4 +idSize +4 ;
675- List fields = classDump .getAllInstanceFields ();
676- Iterator fit = fields .iterator ();
677-
678- while (fit .hasNext ()) {
679- HprofField field = (HprofField ) fit .next ();
680- if (field .getValueType () == HprofHeap .OBJECT ) {
681- long outId = dumpBuffer .getID (inOff );
682-
683- if (outId != 0 ) {
684- LongMap .Entry entry = idToOffsetMap .get (outId );
685- if (entry != null ) {
686- entry .addReference (instanceId );
687- } else {
688- // System.err.println("instance entry:" + Long.toHexString(outId));
673+ if (classDump != null ) {
674+ long instanceId = dumpBuffer .getID (start +1 );
675+ long inOff = start +1 +idSize +4 +idSize +4 ;
676+ List fields = classDump .getAllInstanceFields ();
677+ Iterator fit = fields .iterator ();
678+
679+ while (fit .hasNext ()) {
680+ HprofField field = (HprofField ) fit .next ();
681+ if (field .getValueType () == HprofHeap .OBJECT ) {
682+ long outId = dumpBuffer .getID (inOff );
683+
684+ if (outId != 0 ) {
685+ LongMap .Entry entry = idToOffsetMap .get (outId );
686+ if (entry != null ) {
687+ entry .addReference (instanceId );
688+ } else {
689+ // System.err.println("instance entry:" + Long.toHexString(outId));
690+ }
689691 }
690692 }
693+ inOff += field .getValueSize ();
691694 }
692- inOff += field .getValueSize ();
693695 }
694696 } else if (tag == OBJECT_ARRAY_DUMP ) {
695697 long instanceId = dumpBuffer .getID (start +1 );
0 commit comments