Skip to content

Commit 618dd80

Browse files
authored
Fixed NPE when getContextClassLoader() returns null (#4193)
1 parent ab0091a commit 618dd80

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/main/java/org/testcontainers/utility/MountableFile.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ private static URL getClasspathResource(@NotNull final String resourcePath, @Not
130130
classLoadersToSearch.add(MountableFile.class.getClassLoader());
131131

132132
for (final ClassLoader classLoader : classLoadersToSearch) {
133+
if (classLoader == null) {
134+
continue;
135+
}
136+
133137
URL resource = classLoader.getResource(resourcePath);
134138
if (resource != null) {
135139
return resource;

0 commit comments

Comments
 (0)