HHH-13645 : StatsNamedContainer#getOrCompute throws NullPointerException when computed value is null

This commit is contained in:
Gail Badner 2019-09-27 15:32:25 -07:00 committed by Sanne Grinovero
parent a7d9d75e94
commit 7b104e5ded
1 changed files with 9 additions and 4 deletions

View File

@ -54,12 +54,17 @@ final class StatsNamedContainer<V> {
} }
else { else {
final V v2 = function.apply( key ); final V v2 = function.apply( key );
final V v3 = map.putIfAbsent( key, v2 ); if ( v2 == null ) {
if ( v3 == null ) { return null;
return v2;
} }
else { else {
return v3; final V v3 = map.putIfAbsent( key, v2 );
if ( v3 == null ) {
return v2;
}
else {
return v3;
}
} }
} }
} }