Prevent walk node list index out of bounds exception.

This commit is contained in:
MobiusDev
2018-04-22 23:02:43 +00:00
parent c901550188
commit e95c422e70
7 changed files with 7 additions and 7 deletions

View File

@@ -57,7 +57,7 @@ public class WalkInfo
*/
public L2NpcWalkerNode getCurrentNode()
{
return getRoute().getNodeList().get(_currentNode);
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
}
/**

View File

@@ -57,7 +57,7 @@ public class WalkInfo
*/
public L2NpcWalkerNode getCurrentNode()
{
return getRoute().getNodeList().get(_currentNode);
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
}
/**

View File

@@ -57,7 +57,7 @@ public class WalkInfo
*/
public L2NpcWalkerNode getCurrentNode()
{
return getRoute().getNodeList().get(_currentNode);
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
}
/**

View File

@@ -57,7 +57,7 @@ public class WalkInfo
*/
public L2NpcWalkerNode getCurrentNode()
{
return getRoute().getNodeList().get(_currentNode);
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
}
/**

View File

@@ -57,7 +57,7 @@ public class WalkInfo
*/
public L2NpcWalkerNode getCurrentNode()
{
return getRoute().getNodeList().get(_currentNode);
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
}
/**

View File

@@ -57,7 +57,7 @@ public class WalkInfo
*/
public L2NpcWalkerNode getCurrentNode()
{
return getRoute().getNodeList().get(_currentNode);
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
}
/**

View File

@@ -57,7 +57,7 @@ public class WalkInfo
*/
public L2NpcWalkerNode getCurrentNode()
{
return getRoute().getNodeList().get(_currentNode);
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
}
/**