8280174: Possible NPE in Thread.dispatchUncaughtException

Reviewed-by: alanb
This commit is contained in:
Andrey Turbanov 2022-01-24 11:10:16 +00:00
parent 7a0a6c95a5
commit f05ff99654

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1976,8 +1976,8 @@ public class Thread implements Runnable {
* @return the uncaught exception handler for this thread
*/
public UncaughtExceptionHandler getUncaughtExceptionHandler() {
return uncaughtExceptionHandler != null ?
uncaughtExceptionHandler : group;
UncaughtExceptionHandler handler = this.uncaughtExceptionHandler;
return handler != null ? handler : group;
}
/**