diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-01-07 11:42:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-07 11:42:40 +0100 |
commit | cf4c58838fb148a1087ddd7e5461cc2eb3c386ec (patch) | |
tree | beea0d799e7b5eb3fb83bbed11cf95a0c333ea5d | |
parent | 55e876777c45d8bf6b2952a1d6d9cfc861e97315 (diff) | |
parent | 193564d83e3d248ea35284beed36ff653919256d (diff) |
Merge pull request #44986 from aaronfranke/audiostream
Descriptive error message when using AudioStream(OGG/MP3) incorrectly
-rw-r--r-- | modules/minimp3/audio_stream_mp3.cpp | 5 | ||||
-rw-r--r-- | modules/stb_vorbis/audio_stream_ogg_vorbis.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/modules/minimp3/audio_stream_mp3.cpp b/modules/minimp3/audio_stream_mp3.cpp index 392a2fb565..8627f71987 100644 --- a/modules/minimp3/audio_stream_mp3.cpp +++ b/modules/minimp3/audio_stream_mp3.cpp @@ -120,7 +120,10 @@ AudioStreamPlaybackMP3::~AudioStreamPlaybackMP3() { Ref<AudioStreamPlayback> AudioStreamMP3::instance_playback() { Ref<AudioStreamPlaybackMP3> mp3s; - ERR_FAIL_COND_V(data == nullptr, mp3s); + ERR_FAIL_COND_V_MSG(data == nullptr, mp3s, + "This AudioStreamMP3 does not have an audio file assigned " + "to it. AudioStreamMP3 should not be created from the " + "inspector or with `.new()`. Instead, load an audio file."); mp3s.instance(); mp3s->mp3_stream = Ref<AudioStreamMP3>(this); diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index 82d1206e93..4b2be47e74 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -124,7 +124,10 @@ AudioStreamPlaybackOGGVorbis::~AudioStreamPlaybackOGGVorbis() { Ref<AudioStreamPlayback> AudioStreamOGGVorbis::instance_playback() { Ref<AudioStreamPlaybackOGGVorbis> ovs; - ERR_FAIL_COND_V(data == nullptr, ovs); + ERR_FAIL_COND_V_MSG(data == nullptr, ovs, + "This AudioStreamOGGVorbis does not have an audio file assigned " + "to it. AudioStreamOGGVorbis should not be created from the " + "inspector or with `.new()`. Instead, load an audio file."); ovs.instance(); ovs->vorbis_stream = Ref<AudioStreamOGGVorbis>(this); |