From e566dca620c43d56798770b41cd0d25a63a71b82 Mon Sep 17 00:00:00 2001
From: Andrew Haley <aph@openjdk.org>
Date: Thu, 19 Mar 2020 14:53:57 +0000
Subject: [PATCH] 8241296: Segfault in JNIHandleBlock::oops_do()

Reviewed-by: stefank, shade
---
 src/hotspot/share/runtime/thread.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp
index 0aa68f3941..ca7f0b0fa4 100644
--- a/src/hotspot/share/runtime/thread.cpp
+++ b/src/hotspot/share/runtime/thread.cpp
@@ -872,7 +872,9 @@ bool Thread::claim_oops_do_par_case(int strong_roots_parity) {
 }
 
 void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
-  active_handles()->oops_do(f);
+  if (active_handles() != NULL) {
+    active_handles()->oops_do(f);
+  }
   // Do oop for ThreadShadow
   f->do_oop((oop*)&_pending_exception);
   handle_area()->oops_do(f);
