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:
Max Kellermann 2009-01-24 19:16:33 +01:00
parent 14b37656a6
commit 793934cf9c

View File

@ -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) {