mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Merge #6432
6432: check for success when decoding audio r=Robyt3 a=Marmare314 ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: marmare314 <49279081+Marmare314@users.noreply.github.com>
This commit is contained in:
commit
e5a51d5952
|
@ -608,6 +608,8 @@ int CSound::LoadOpus(const char *pFilename)
|
||||||
|
|
||||||
SampleID = DecodeOpus(SampleID, pData, DataSize);
|
SampleID = DecodeOpus(SampleID, pData, DataSize);
|
||||||
free(pData);
|
free(pData);
|
||||||
|
if(SampleID < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if(g_Config.m_Debug)
|
if(g_Config.m_Debug)
|
||||||
dbg_msg("sound/opus", "loaded %s", pFilename);
|
dbg_msg("sound/opus", "loaded %s", pFilename);
|
||||||
|
@ -648,6 +650,8 @@ int CSound::LoadWV(const char *pFilename)
|
||||||
|
|
||||||
SampleID = DecodeWV(SampleID, pData, DataSize);
|
SampleID = DecodeWV(SampleID, pData, DataSize);
|
||||||
free(pData);
|
free(pData);
|
||||||
|
if(SampleID < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if(g_Config.m_Debug)
|
if(g_Config.m_Debug)
|
||||||
dbg_msg("sound/wv", "loaded %s", pFilename);
|
dbg_msg("sound/wv", "loaded %s", pFilename);
|
||||||
|
@ -703,6 +707,8 @@ int CSound::LoadWVFromMem(const void *pData, unsigned DataSize, bool FromEditor
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
SampleID = DecodeWV(SampleID, pData, DataSize);
|
SampleID = DecodeWV(SampleID, pData, DataSize);
|
||||||
|
if(SampleID < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
RateConvert(SampleID);
|
RateConvert(SampleID);
|
||||||
return SampleID;
|
return SampleID;
|
||||||
|
|
Loading…
Reference in a new issue