From 635c8c9290c9d496df993e1a1afa82176d089c4a Mon Sep 17 00:00:00 2001 From: kimci86 Date: Sun, 6 Aug 2023 17:41:23 +0200 Subject: [PATCH] Make Sound::getBuffer return a reference because the pointer now cannot be null --- include/SFML/Audio/Sound.hpp | 4 ++-- src/SFML/Audio/Sound.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/SFML/Audio/Sound.hpp b/include/SFML/Audio/Sound.hpp index 90e1bb1f..b1efb8f8 100644 --- a/include/SFML/Audio/Sound.hpp +++ b/include/SFML/Audio/Sound.hpp @@ -164,10 +164,10 @@ public: //////////////////////////////////////////////////////////// /// \brief Get the audio buffer attached to the sound /// - /// \return Sound buffer attached to the sound (can be a null pointer) + /// \return Sound buffer attached to the sound /// //////////////////////////////////////////////////////////// - const SoundBuffer* getBuffer() const; + const SoundBuffer& getBuffer() const; //////////////////////////////////////////////////////////// /// \brief Tell whether or not the sound is in loop mode diff --git a/src/SFML/Audio/Sound.cpp b/src/SFML/Audio/Sound.cpp index 4cd79413..b97d0ae4 100644 --- a/src/SFML/Audio/Sound.cpp +++ b/src/SFML/Audio/Sound.cpp @@ -110,9 +110,9 @@ void Sound::setPlayingOffset(Time timeOffset) //////////////////////////////////////////////////////////// -const SoundBuffer* Sound::getBuffer() const +const SoundBuffer& Sound::getBuffer() const { - return m_buffer; + return *m_buffer; }