File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -212,19 +212,21 @@ Ref<AudioStreamOggVorbis> ResourceImporterOggVorbis::load_from_buffer(const Vect
212212 granule_pos = packet.granulepos ;
213213 }
214214
215- PackedByteArray data;
216- data.resize (packet.bytes );
217- memcpy (data.ptrw (), packet.packet , packet.bytes );
218- sorted_packets[granule_pos].push_back (data);
219- packet_count++;
215+ if (packet.bytes > 0 ) {
216+ PackedByteArray data;
217+ data.resize (packet.bytes );
218+ memcpy (data.ptrw (), packet.packet , packet.bytes );
219+ sorted_packets[granule_pos].push_back (data);
220+ packet_count++;
221+ }
220222 }
221223 Vector<Vector<uint8_t >> packet_data;
222224 for (const KeyValue<uint64_t , Vector<Vector<uint8_t >>> &pair : sorted_packets) {
223225 for (const Vector<uint8_t > &packets : pair.value ) {
224226 packet_data.push_back (packets);
225227 }
226228 }
227- if (initialized_stream) {
229+ if (initialized_stream && packet_data. size () > 0 ) {
228230 ogg_packet_sequence->push_page (ogg_page_granulepos (&page), packet_data);
229231 }
230232 }
You can’t perform that action at this time.
0 commit comments