mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Assert against UB in sf::Touch::getPosition
This commit is contained in:
parent
c38b98c653
commit
c96cb59845
@ -28,6 +28,8 @@
|
|||||||
#include <SFML/Window/InputImpl.hpp>
|
#include <SFML/Window/InputImpl.hpp>
|
||||||
#include <SFML/Window/Touch.hpp>
|
#include <SFML/Window/Touch.hpp>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
|
||||||
namespace sf::Touch
|
namespace sf::Touch
|
||||||
{
|
{
|
||||||
@ -41,6 +43,7 @@ bool isDown(unsigned int finger)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Vector2i getPosition(unsigned int finger)
|
Vector2i getPosition(unsigned int finger)
|
||||||
{
|
{
|
||||||
|
assert(isDown(finger) && "Touch::getPosition() Finger must already be down");
|
||||||
return priv::InputImpl::getTouchPosition(finger);
|
return priv::InputImpl::getTouchPosition(finger);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +51,7 @@ Vector2i getPosition(unsigned int finger)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Vector2i getPosition(unsigned int finger, const WindowBase& relativeTo)
|
Vector2i getPosition(unsigned int finger, const WindowBase& relativeTo)
|
||||||
{
|
{
|
||||||
|
assert(isDown(finger) && "Touch::getPosition() Finger must already be down");
|
||||||
return priv::InputImpl::getTouchPosition(finger, relativeTo);
|
return priv::InputImpl::getTouchPosition(finger, relativeTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user