fix potential crash when lazily loading a sound that doesn't exist
This commit is contained in:
parent
0ffa991395
commit
de85036ab5
1 changed files with 6 additions and 2 deletions
|
@ -480,8 +480,12 @@ static int PlaySample(Mix_Chunk *sample, Origin *origin, void (*callback)(int ch
|
|||
if (sample->allocated == 0xcafebeef) {
|
||||
char *name = (char*)(sample->abuf);
|
||||
Mix_Chunk *loadedSample = ForceLoadSample(name);
|
||||
memcpy(sample, loadedSample, sizeof(Mix_Chunk));
|
||||
free(name);
|
||||
if (loadedSample) {
|
||||
memcpy(sample, loadedSample, sizeof(Mix_Chunk));
|
||||
free(name);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
int channel = -1;
|
||||
|
|
Loading…
Reference in a new issue