modplug: check for input_stream errors
When input_stream_read() returns 0, and input_stream_eof() returns false, an I/O error has occured. Skip this song.
This commit is contained in:
parent
14b37656a6
commit
793934cf9c
@ -58,8 +58,14 @@ static GByteArray *mod_loadfile(struct decoder *decoder, struct input_stream *is
|
||||
do {
|
||||
ret = decoder_read(decoder, is, data, MODPLUG_READ_BLOCK);
|
||||
if (ret == 0) {
|
||||
//end of file, or read error
|
||||
break;
|
||||
if (input_stream_eof(is))
|
||||
/* end of file */
|
||||
break;
|
||||
|
||||
/* I/O error - skip this song */
|
||||
g_free(data);
|
||||
g_byte_array_free(bdatas, true);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bdatas->len + ret > MODPLUG_FILE_LIMIT) {
|
||||
|
Loading…
Reference in New Issue
Block a user