Преглед на файлове

allow negative index to mean from end of list asset

master
Jonathan Cobb преди 3 години
родител
ревизия
37b66885f8
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. +2
    -2
      src/main/java/jvc/service/AssetManager.java

+ 2
- 2
src/main/java/jvc/service/AssetManager.java Целия файл

@@ -129,8 +129,8 @@ public class AssetManager {
} else {
// single element
final int index = parseIndexExpression(indexExpr, list, JIndexType.single);
if (index < 0 || index >= list.length) return die("parseIndexExpression("+indexExpr+"): index out of range: "+index);
return list[index];
if (Math.abs(index) >= list.length) return die("parseIndexExpression("+indexExpr+"): index out of range: "+index);
return index < 0 ? list[list.length + index] : list[index];
}

} else {


Зареждане…
Отказ
Запис