diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp index 7fd44b4f..69687d0a 100644 --- a/include/SFML/Graphics/Sprite.hpp +++ b/include/SFML/Graphics/Sprite.hpp @@ -265,7 +265,10 @@ private: /// \code /// // Declare and load a texture /// sf::Texture texture; -/// texture.loadFromFile("texture.png"); +/// if (!texture.loadFromFile("texture.png")) +/// { +/// // Handle error... +/// } /// /// // Create a sprite /// sf::Sprite sprite(texture); diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp index be49fcae..17d8cb0e 100644 --- a/include/SFML/Graphics/Text.hpp +++ b/include/SFML/Graphics/Text.hpp @@ -464,7 +464,10 @@ private: /// \code /// // Declare and load a font /// sf::Font font; -/// font.loadFromFile("arial.ttf"); +/// if (!font.loadFromFile("arial.ttf")) +/// { +/// // Handle error... +/// } /// /// // Create a text /// sf::Text text(font, "hello"); diff --git a/include/SFML/Graphics/Texture.hpp b/include/SFML/Graphics/Texture.hpp index 6dbad6c9..9d4137c9 100644 --- a/include/SFML/Graphics/Texture.hpp +++ b/include/SFML/Graphics/Texture.hpp @@ -120,8 +120,10 @@ public: /// This function is a shortcut for the following code: /// \code /// sf::Image image; - /// image.loadFromFile(filename); - /// texture.loadFromImage(image, area); + /// if (!image.loadFromFile(filename)) + /// return false; + /// if (!texture.loadFromImage(image, area)) + /// return false; /// \endcode /// /// The \a area argument can be used to load only a sub-rectangle @@ -151,8 +153,10 @@ public: /// This function is a shortcut for the following code: /// \code /// sf::Image image; - /// image.loadFromMemory(data, size); - /// texture.loadFromImage(image, area); + /// if (!image.loadFromMemory(data, size)) + /// return false; + /// if (!texture.loadFromImage(image, area)) + /// return false; /// \endcode /// /// The \a area argument can be used to load only a sub-rectangle @@ -183,8 +187,10 @@ public: /// This function is a shortcut for the following code: /// \code /// sf::Image image; - /// image.loadFromStream(stream); - /// texture.loadFromImage(image, area); + /// if (!image.loadFromStream(stream)) + /// return false; + /// if (!texture.loadFromImage(image, area)) + /// return false; /// \endcode /// /// The \a area argument can be used to load only a sub-rectangle