From 65681e74d8c76546371429260ac1a2e0b6ad2665 Mon Sep 17 00:00:00 2001 From: Ivan Hetman Date: Mon, 16 Oct 2023 14:59:35 +0300 Subject: [PATCH] classlib: small PriorityQueue fixes (#823) --- .../java/org/teavm/classlib/java/util/TPriorityQueue.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TPriorityQueue.java b/classlib/src/main/java/org/teavm/classlib/java/util/TPriorityQueue.java index ad871ab1f..d43dcdd5f 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TPriorityQueue.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TPriorityQueue.java @@ -48,8 +48,8 @@ public class TPriorityQueue extends TAbstractQueue implements TSerializabl initFromSortedSet((TSortedSet) c); } else { data = new Object[c.size()]; - fillFromCollection(c); setComparator(null); + fillFromCollection(c); } } @@ -170,6 +170,9 @@ public class TPriorityQueue extends TAbstractQueue implements TSerializabl if (version != knownVersion) { throw new TConcurrentModificationException(); } + if (index >= size) { + throw new TNoSuchElementException(); + } removeIndex = index; return (E) data[index++]; }