@@ -221,19 +221,21 @@ static void
221
221
destroyThreadData (J9JVMTIEnv * j9env , J9VMThread * vmThread )
222
222
{
223
223
j9object_t threadObject = vmThread -> threadObject ;
224
+ if (NULL != threadObject ) {
224
225
#if JAVA_SPEC_VERSION >= 19
225
- void * tlsArray = J9OBJECT_ADDRESS_LOAD (vmThread , threadObject , vmThread -> javaVM -> tlsOffset );
226
+ void * tlsArray = J9OBJECT_ADDRESS_LOAD (vmThread , threadObject , vmThread -> javaVM -> tlsOffset );
226
227
227
- if (NULL != tlsArray )
228
+ if (NULL != tlsArray )
228
229
#endif /* JAVA_SPEC_VERSION >= 19 */
229
- {
230
- /* Deallocate the thread data block for this environment/thread pair, if it exists. */
231
- J9JVMTIThreadData * threadData = jvmtiTLSGet (vmThread , threadObject , j9env -> tlsKey );
232
- if (NULL != threadData ) {
233
- jvmtiTLSSet (vmThread , threadObject , j9env -> tlsKey , NULL );
234
- omrthread_monitor_enter (j9env -> threadDataPoolMutex );
235
- pool_removeElement (j9env -> threadDataPool , threadData );
236
- omrthread_monitor_exit (j9env -> threadDataPoolMutex );
230
+ {
231
+ /* Deallocate the thread data block for this environment/thread pair, if it exists. */
232
+ J9JVMTIThreadData * threadData = jvmtiTLSGet (vmThread , threadObject , j9env -> tlsKey );
233
+ if (NULL != threadData ) {
234
+ jvmtiTLSSet (vmThread , threadObject , j9env -> tlsKey , NULL );
235
+ omrthread_monitor_enter (j9env -> threadDataPoolMutex );
236
+ pool_removeElement (j9env -> threadDataPool , threadData );
237
+ omrthread_monitor_exit (j9env -> threadDataPoolMutex );
238
+ }
237
239
}
238
240
}
239
241
}
0 commit comments