Fix EA-XMA segfault

This commit is contained in:
bnnm 2019-02-22 23:35:16 +01:00
parent a2a43c2502
commit 7e6e8900c2

View File

@ -1054,6 +1054,9 @@ static size_t calculate_eaac_size(VGMSTREAM *vgmstream, STREAMFILE *streamFile,
uint32_t total_samples; uint32_t total_samples;
size_t stream_size, file_size; size_t stream_size, file_size;
if (streamFile == NULL)
return 0;
switch (eaac->codec) { switch (eaac->codec) {
case EAAC_CODEC_EAXMA: case EAAC_CODEC_EAXMA:
case EAAC_CODEC_EALAYER3_V1: case EAAC_CODEC_EALAYER3_V1:
@ -1154,6 +1157,7 @@ static segmented_layout_data* build_segmented_eaaudiocore_looping(STREAMFILE *st
if (!vgmstream_open_stream(data->segments[i],temp_streamFile[i],0x00)) if (!vgmstream_open_stream(data->segments[i],temp_streamFile[i],0x00))
goto fail; goto fail;
//todo temp_streamFile doesn't contain EAXMA's streamfile
data->segments[i]->stream_size = calculate_eaac_size(data->segments[i], temp_streamFile[i], eaac, 0x00); data->segments[i]->stream_size = calculate_eaac_size(data->segments[i], temp_streamFile[i], eaac, 0x00);
} }