diff --git a/core/src/processing/data/StringList.java b/core/src/processing/data/StringList.java index 65d73ceb9..3507545b6 100644 --- a/core/src/processing/data/StringList.java +++ b/core/src/processing/data/StringList.java @@ -150,8 +150,9 @@ public class StringList implements Iterable { if (count == 0) { throw new RuntimeException("Can't call pop() on an empty list"); } - String value = get(count-1); - count--; + count--; // back up to the last entry + String value = get(count); + data[count] = null; // avoid leak return value; }