Fix invalid write in AudioStreamSample::save_to_wav

Fixes #29955

(cherry picked from commit ea949ab873)
This commit is contained in:
Bojidar Marinov 2019-07-16 20:58:00 +03:00 committed by Rémi Verschelde
parent 20822ee87d
commit 794bfe8aaa
1 changed files with 2 additions and 1 deletions

View File

@ -564,7 +564,8 @@ Error AudioStreamSample::save_to_wav(const String &p_path) {
file->store_32(sub_chunk_2_size); //Subchunk2Size
// Add data
PoolVector<uint8_t>::Read read_data = get_data().read();
PoolVector<uint8_t> data = get_data();
PoolVector<uint8_t>::Read read_data = data.read();
switch (format) {
case AudioStreamSample::FORMAT_8_BITS:
for (unsigned int i = 0; i < data_bytes; i++) {