From f7608276e35d03d5ad2d38f2189c6d6f5279c432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= Date: Thu, 23 Sep 2021 23:27:49 +0200 Subject: Audaspace: port bugfix from upstream. Fixes T91615: Instant crash when dragging video file into video editor sequencer --- extern/audaspace/bindings/C/AUD_Sound.cpp | 34 +++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/extern/audaspace/bindings/C/AUD_Sound.cpp b/extern/audaspace/bindings/C/AUD_Sound.cpp index aa246b9a047..8a3c9d1bbc9 100644 --- a/extern/audaspace/bindings/C/AUD_Sound.cpp +++ b/extern/audaspace/bindings/C/AUD_Sound.cpp @@ -102,26 +102,30 @@ AUD_API int AUD_Sound_getFileStreams(AUD_Sound* sound, AUD_StreamInfo **stream_i if(file) { - auto streams = file->queryStreams(); + try + { + auto streams = file->queryStreams(); - size_t size = sizeof(AUD_StreamInfo) * streams.size(); + size_t size = sizeof(AUD_StreamInfo) * streams.size(); - if(!size) - { - *stream_infos = nullptr; - return 0; - } + if(!size) + { + *stream_infos = nullptr; + return 0; + } - *stream_infos = reinterpret_cast(std::malloc(size)); - std::memcpy(*stream_infos, streams.data(), size); + *stream_infos = reinterpret_cast(std::malloc(size)); + std::memcpy(*stream_infos, streams.data(), size); - return streams.size(); - } - else - { - *stream_infos = nullptr; - return 0; + return streams.size(); + } + catch(Exception&) + { + } } + + *stream_infos = nullptr; + return 0; } AUD_API sample_t* AUD_Sound_data(AUD_Sound* sound, int* length, AUD_Specs* specs) -- cgit v1.2.3