Transport: Fix NPE at shutdown caused by _currentAddresses change

This commit is contained in:
zzz
2022-12-17 13:54:37 -05:00
parent 73d226e7d7
commit 33f9bd8156

View File

@@ -610,9 +610,14 @@ public abstract class TransportImpl implements Transport {
* @param address null to remove all
*/
protected void replaceAddress(RouterAddress address) {
boolean isIPv6 = TransportUtil.isIPv6(address);
if (_log.shouldWarn())
_log.warn("Replacing IPv" + (isIPv6 ? '6' : '4') + " address with " + address, new Exception());
boolean isIPv6;
if (address != null) {
isIPv6 = TransportUtil.isIPv6(address);
if (_log.shouldWarn())
_log.warn("Replacing IPv" + (isIPv6 ? '6' : '4') + " address with " + address, new Exception());
} else {
isIPv6 = false;
}
int sz;
synchronized(_currentAddresses) {
if (address == null) {