From 423a931c9cca29ead993adbf2d562bb5ebc94ccc Mon Sep 17 00:00:00 2001 From: water <672684719@qq.com> Date: Tue, 11 Aug 2026 19:51:00 +0800 Subject: [PATCH] fix: return empty PAnnotationValue for NullAnnotation to prevent NPE --- .../profiler/context/grpc/mapper/AnnotationValueMapper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/grpc/mapper/AnnotationValueMapper.java b/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/grpc/mapper/AnnotationValueMapper.java index 843b0877903d..15286d26220a 100644 --- a/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/grpc/mapper/AnnotationValueMapper.java +++ b/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/grpc/mapper/AnnotationValueMapper.java @@ -139,7 +139,9 @@ default PBytesStringStringValue.Builder getBytesStringStringBuilder() { @ToPAnnotationValue default PAnnotationValue map(Annotation annotation) { if (annotation instanceof NullAnnotation) { - return null; + // Return an empty PAnnotationValue instead of null to avoid NPE in callers + // that unconditionally set the result on a PAnnotation.Builder. + return getAnnotationBuilder().build(); } return mapNonNull(annotation); }