Prevent walk node list index out of bounds exception.
This commit is contained in:
@@ -57,7 +57,7 @@ public class WalkInfo
|
|||||||
*/
|
*/
|
||||||
public L2NpcWalkerNode getCurrentNode()
|
public L2NpcWalkerNode getCurrentNode()
|
||||||
{
|
{
|
||||||
return getRoute().getNodeList().get(_currentNode);
|
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -57,7 +57,7 @@ public class WalkInfo
|
|||||||
*/
|
*/
|
||||||
public L2NpcWalkerNode getCurrentNode()
|
public L2NpcWalkerNode getCurrentNode()
|
||||||
{
|
{
|
||||||
return getRoute().getNodeList().get(_currentNode);
|
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -57,7 +57,7 @@ public class WalkInfo
|
|||||||
*/
|
*/
|
||||||
public L2NpcWalkerNode getCurrentNode()
|
public L2NpcWalkerNode getCurrentNode()
|
||||||
{
|
{
|
||||||
return getRoute().getNodeList().get(_currentNode);
|
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -57,7 +57,7 @@ public class WalkInfo
|
|||||||
*/
|
*/
|
||||||
public L2NpcWalkerNode getCurrentNode()
|
public L2NpcWalkerNode getCurrentNode()
|
||||||
{
|
{
|
||||||
return getRoute().getNodeList().get(_currentNode);
|
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -57,7 +57,7 @@ public class WalkInfo
|
|||||||
*/
|
*/
|
||||||
public L2NpcWalkerNode getCurrentNode()
|
public L2NpcWalkerNode getCurrentNode()
|
||||||
{
|
{
|
||||||
return getRoute().getNodeList().get(_currentNode);
|
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -57,7 +57,7 @@ public class WalkInfo
|
|||||||
*/
|
*/
|
||||||
public L2NpcWalkerNode getCurrentNode()
|
public L2NpcWalkerNode getCurrentNode()
|
||||||
{
|
{
|
||||||
return getRoute().getNodeList().get(_currentNode);
|
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -57,7 +57,7 @@ public class WalkInfo
|
|||||||
*/
|
*/
|
||||||
public L2NpcWalkerNode getCurrentNode()
|
public L2NpcWalkerNode getCurrentNode()
|
||||||
{
|
{
|
||||||
return getRoute().getNodeList().get(_currentNode);
|
return getRoute().getNodeList().get(Math.min(Math.max(0, _currentNode), getRoute().getNodeList().size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user