Skip to content

Commit

Permalink
Fix move path validation again
Browse files Browse the repository at this point in the history
  • Loading branch information
ziggi committed Oct 19, 2016
1 parent 79cd2cb commit baef56e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/CMovePath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bool CMovePath::Destroy(int iPathId)

bool CMovePath::IsPathValid(int iPathId)
{
return static_cast<int>(m_vPath.size()) < iPathId;
return iPathId >= 0 && static_cast<int>(m_vPath.size()) > iPathId;
}

std::vector<CVector> *CMovePath::GetPoints(int iPathId)
Expand Down Expand Up @@ -60,7 +60,7 @@ bool CMovePath::IsPointValid(int iPathId, int iPointId)
if (!IsPathValid(iPathId)) {
return false;
}
return static_cast<int>(m_vPath[iPathId].size()) < iPointId;
return iPointId >= 0 && static_cast<int>(m_vPath[iPathId].size()) > iPointId;
}

CVector *CMovePath::GetPoint(int iPathId, int iPointId)
Expand Down

0 comments on commit baef56e

Please sign in to comment.