Skip to content

Commit

Permalink
Add null check for the return value of ReferenceQueue#remove() (#7304)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek authored Nov 25, 2022
1 parent 6ea1c24 commit 7e2924c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ static void runCleanup() {
try {
while (!Thread.interrupted()) {
Reference<?> reference = REFERENCE_QUEUE.remove();
removeWeakKey((WeakKey<?>) reference);
if (reference != null) {
removeWeakKey((WeakKey<?>) reference);
}
}
} catch (InterruptedException ignored) {
// do nothing
Expand Down

0 comments on commit 7e2924c

Please sign in to comment.