Skip to content

Commit bca62a5

Browse files
committed
RP2040 BaseStream correct read() empty to -1
1 parent 6a98cc1 commit bca62a5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/AudioTools/CoreAudio/BaseStream.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,15 @@ class BaseStream : public Stream {
7272

7373
virtual int read() override {
7474
refillReadBuffer();
75+
// if it is empty we need to return an int -1
76+
if (tmp_in.isEmpty()) return -1;
7577
return tmp_in.read();
7678
}
7779

7880
virtual int peek() override {
7981
refillReadBuffer();
82+
// if it is empty we need to return an int -1
83+
if (tmp_in.isEmpty()) return -1;
8084
return tmp_in.peek();
8185
}
8286

0 commit comments

Comments
 (0)