File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ class AudioSourceURL : public AudioSource {
4646
4747 // / Opens the selected url from the array
4848 Stream* selectStream (int idx) override {
49+ if (size ()==0 ) return nullptr ;
4950 pos = idx;
5051 if (pos < 0 ) {
5152 pos = 0 ;
@@ -57,7 +58,9 @@ class AudioSourceURL : public AudioSource {
5758 }
5859 LOGI (" selectStream: %d/%d -> %s" , pos, size () - 1 , value (pos));
5960 if (started) actual_stream->end ();
60- actual_stream->begin (value (pos), mime);
61+ const char * url = value (pos);
62+ if (url == nullptr ) return nullptr ;
63+ actual_stream->begin (url, mime);
6164 started = true ;
6265 return actual_stream;
6366 }
@@ -121,7 +124,7 @@ class AudioSourceURL : public AudioSource {
121124 AudioSourceURL () = default ;
122125
123126 virtual const char * value (int pos) {
124- if (urlArray == nullptr ) return nullptr ;
127+ if (urlArray == nullptr || size ()== 0 ) return nullptr ;
125128 return urlArray[pos];
126129 }
127130
You can’t perform that action at this time.
0 commit comments