Skip to content

IntList and FloatList have an inconsistent bound management #2341

Description

@PhiLhoSoft

Issue found out in the http://forum.processing.org/two/discussion/2473/out-of-bounds-intlist-index-returns-zero thread.

IntList il = new IntList();
println(il.get(3));
println(il.get(10));
exit();

The first access returns zero, the second one issues an ArrayIndexOutOfBoundsException.

I suggest that these structures check the given index against the size() of the data and generate themselves an IndexOutOfBoundsException, or return consistently zero in this case, if you want to avoid to throw exceptions.
The exception is probably better, as it is the behavior of ArrayList, officially part of Processing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions