mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
bounds check ChainShape:getPoint, and make functions that take indices 1-indexed on the Lua end of things
This commit is contained in:
@@ -99,6 +99,8 @@ namespace box2d
|
||||
b2Vec2 ChainShape::getPoint(int index) const
|
||||
{
|
||||
b2ChainShape * c = (b2ChainShape *)shape;
|
||||
if (index < 0 || index >= c->m_count)
|
||||
throw love::Exception("Physics error: index out of bounds");
|
||||
const b2Vec2 & v = c->m_vertices[index];
|
||||
return Physics::scaleUp(v);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user