Skip to content

Commit

Permalink
fix: NPE in iterator usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Col-E committed Jul 24, 2020
1 parent 398d6bc commit 3761119
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>me.coley</groupId>
<artifactId>cafedude</artifactId>
<url>https://github.com/Col-E/CAFED00D/</url>
<version>1.1.0</version>
<version>1.1.1</version>
<name>CAFED00D</name>

<properties>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/me/coley/cafedude/ConstPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public int size() {
public int indexOf(ConstPoolEntry entry) {
CpIter it = (CpIter) iterator();
ConstPoolEntry itEntry = null;
while ((itEntry = it.next()) != null) {
while (it.hasNext() && (itEntry = it.next()) != null) {
if (entry.equals(itEntry))
return it.currentIndex();
}
Expand All @@ -110,7 +110,7 @@ public int indexOf(ConstPoolEntry entry) {
public void removeIf(Predicate<ConstPoolEntry> filter) {
CpIter it = (CpIter) iterator();
ConstPoolEntry entry = null;
while ((entry = it.next()) != null) {
while (it.hasNext() && (entry = it.next()) != null) {
if (filter.test(entry))
it.remove();
}
Expand All @@ -127,7 +127,7 @@ public void removeIf(Predicate<ConstPoolEntry> filter) {
public void replaceIf(Predicate<ConstPoolEntry> filter, Function<ConstPoolEntry, ConstPoolEntry> replacer) {
CpIter it = (CpIter) iterator();
ConstPoolEntry entry = null;
while ((entry = it.next()) != null) {
while (it.hasNext() && (entry = it.next()) != null) {
if (filter.test(entry))
it.replace(replacer.apply(entry));
}
Expand Down

0 comments on commit 3761119

Please sign in to comment.