Skip to content

Commit

Permalink
ListTag: use parseIndex more
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 4, 2021
1 parent 48bc71c commit 3de1565
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -996,7 +996,7 @@ else if (input.size() > 1) {
ListTag items = getListFor(attribute.getContextObject(1), attribute.context);
if (attribute.startsWith("at", 2) && attribute.hasContext(2)) {
ListTag result = new ListTag(object);
int index = attribute.getIntContext(2) - 1;
int index = object.parseIndex(attribute.getContext(2));
if (index < 0) {
index = 0;
}
Expand Down Expand Up @@ -1032,7 +1032,7 @@ else if (input.size() > 1) {
ListTag items = getListFor(attribute.getContextObject(1), attribute.context);
if (attribute.startsWith("at", 2) && attribute.hasContext(2)) {
ListTag result = new ListTag(object);
int index = attribute.getIntContext(2) - 1;
int index = object.parseIndex(attribute.getContext(2));
if (index > result.size() - 1) {
index = result.size() - 1;
}
Expand Down Expand Up @@ -1069,7 +1069,7 @@ else if (input.size() > 1) {
ObjectTag value = attribute.getContextObject(1);
if (attribute.startsWith("at", 2) && attribute.hasContext(2)) {
ListTag result = new ListTag(object);
int index = attribute.getIntContext(2) - 1;
int index = object.parseIndex(attribute.getContext(2));
if (index > result.size() - 1) {
index = result.size() - 1;
}
Expand Down Expand Up @@ -1109,7 +1109,7 @@ else if (input.size() > 1) {
ListTag items = getListFor(attribute.getContextObject(1), attribute.context);
if (attribute.startsWith("at", 2) && attribute.hasContext(2)) {
ListTag result = new ListTag(object);
int index = attribute.getIntContext(2) - 1;
int index = object.parseIndex(attribute.getContext(2));
if (index < 0) {
index = 0;
}
Expand Down

0 comments on commit 3de1565

Please sign in to comment.