mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-06 19:40:10 +02:00
Fix assertion failure when reading end of stream
Getting the address of the end of a vector apparently raises an assertion failure now, even if we didn't do anything with it.
This commit is contained in:
@@ -143,15 +143,17 @@ tresult PLUGIN_API YaBStream::read(void* buffer,
|
||||
std::min(static_cast<int64_t>(numBytes),
|
||||
static_cast<int64_t>(this->buffer.size()) - seek_position);
|
||||
|
||||
std::copy_n(&this->buffer[seek_position], bytes_to_read,
|
||||
reinterpret_cast<uint8_t*>(buffer));
|
||||
if (bytes_to_read > 0) {
|
||||
std::copy_n(&this->buffer[seek_position], bytes_to_read,
|
||||
reinterpret_cast<uint8_t*>(buffer));
|
||||
seek_position += bytes_to_read;
|
||||
}
|
||||
|
||||
seek_position += bytes_to_read;
|
||||
if (numBytesRead) {
|
||||
*numBytesRead = static_cast<int32>(bytes_to_read);
|
||||
}
|
||||
|
||||
return Steinberg::kResultOk;
|
||||
return bytes_to_read > 0 ? Steinberg::kResultOk : Steinberg::kResultFalse;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaBStream::write(void* buffer,
|
||||
|
||||
Reference in New Issue
Block a user