From 93d4ad4dd4cc4c5700af3453cfb3e21a804c8c14 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Thu, 21 Nov 2024 18:26:23 +0000 Subject: [PATCH] 8344763: cpCache print_on doesn't handle nulls Reviewed-by: matsaave --- src/hotspot/share/oops/cpCache.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/oops/cpCache.cpp b/src/hotspot/share/oops/cpCache.cpp index bcf3669c9df..66650ee65bf 100644 --- a/src/hotspot/share/oops/cpCache.cpp +++ b/src/hotspot/share/oops/cpCache.cpp @@ -829,9 +829,15 @@ oop ConstantPoolCache::appendix_if_resolved(ResolvedMethodEntry* method_entry) c void ConstantPoolCache::print_on(outputStream* st) const { st->print_cr("%s", internal_name()); // print constant pool cache entries - print_resolved_field_entries(st); - print_resolved_method_entries(st); - print_resolved_indy_entries(st); + if (_resolved_field_entries != nullptr) { + print_resolved_field_entries(st); + } + if (_resolved_method_entries != nullptr) { + print_resolved_method_entries(st); + } + if (_resolved_indy_entries != nullptr) { + print_resolved_indy_entries(st); + } } void ConstantPoolCache::print_resolved_field_entries(outputStream* st) const {