Skip to content

Commit e5c8728

Browse files
authored
Avoid NPE on tomcat classloading instrumentation (#10256)
1 parent 5312aa4 commit e5c8728

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dd-java-agent/instrumentation/tomcat/tomcat-9.0/src/main/java/datadog/trace/instrumentation/tomcat9/WebappClassLoaderInstrumentation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void onContextAvailable(
4141
@Advice.This final WebappClassLoaderBase classLoader,
4242
@Advice.Argument(0) final WebResourceRoot webResourceRoot) {
4343
// at this moment we have the context set in this classloader, hence its name
44-
final Context context = webResourceRoot.getContext();
44+
final Context context = webResourceRoot != null ? webResourceRoot.getContext() : null;
4545
if (context == null) {
4646
return;
4747
}

0 commit comments

Comments
 (0)