From 08fea611547d96136d026d12cac18bd83934924b Mon Sep 17 00:00:00 2001 From: laurentgom Date: Thu, 5 Feb 2009 16:22:33 +0000 Subject: [PATCH] Added a test to ensure the parameter of sf::Sleep is not negative (can have bad consequences) git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1006 4e206d99-4929-0410-ac5d-dfc041789085 --- include/SFML/System/Sleep.hpp | 2 +- src/SFML/System/Sleep.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/SFML/System/Sleep.hpp b/include/SFML/System/Sleep.hpp index 8cc23f526..f131d934e 100644 --- a/include/SFML/System/Sleep.hpp +++ b/include/SFML/System/Sleep.hpp @@ -36,7 +36,7 @@ namespace sf //////////////////////////////////////////////////////////// /// Make the current thread sleep for a given time /// - /// \param Duration : Time to sleep, in seconds + /// \param Duration : Time to sleep, in seconds (must be >= 0) /// //////////////////////////////////////////////////////////// void SFML_API Sleep(float Duration); diff --git a/src/SFML/System/Sleep.cpp b/src/SFML/System/Sleep.cpp index 1c2205411..a984db01e 100644 --- a/src/SFML/System/Sleep.cpp +++ b/src/SFML/System/Sleep.cpp @@ -36,7 +36,8 @@ namespace sf //////////////////////////////////////////////////////////// void Sleep(float Duration) { - priv::Platform::Sleep(Duration); + if (Duration >= 0) + priv::Platform::Sleep(Duration); } } // namespace sf