Descriptive error message when using AudioStream(OGG/MP3) incorrectly
(cherry picked from commit 193564d83e
)
This commit is contained in:
parent
d16f2bddee
commit
6e1b2af770
@ -120,7 +120,10 @@ AudioStreamPlaybackMP3::~AudioStreamPlaybackMP3() {
|
|||||||
Ref<AudioStreamPlayback> AudioStreamMP3::instance_playback() {
|
Ref<AudioStreamPlayback> AudioStreamMP3::instance_playback() {
|
||||||
Ref<AudioStreamPlaybackMP3> mp3s;
|
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.instance();
|
||||||
mp3s->mp3_stream = Ref<AudioStreamMP3>(this);
|
mp3s->mp3_stream = Ref<AudioStreamMP3>(this);
|
||||||
|
@ -130,7 +130,10 @@ Ref<AudioStreamPlayback> AudioStreamOGGVorbis::instance_playback() {
|
|||||||
|
|
||||||
Ref<AudioStreamPlaybackOGGVorbis> ovs;
|
Ref<AudioStreamPlaybackOGGVorbis> ovs;
|
||||||
|
|
||||||
ERR_FAIL_COND_V(data == NULL, ovs);
|
ERR_FAIL_COND_V_MSG(data == NULL, 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.instance();
|
||||||
ovs->vorbis_stream = Ref<AudioStreamOGGVorbis>(this);
|
ovs->vorbis_stream = Ref<AudioStreamOGGVorbis>(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user