Skip to content

Commit d691946

Browse files
committed
snd_xmp.c: handle the tricky xmp_set_position() return code better
1 parent eba600f commit d691946

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

engine/h2shared/snd_xmp.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,13 @@ static void S_XMP_CodecCloseStream (snd_stream_t *stream)
158158

159159
static int S_XMP_CodecJumpToOrder (snd_stream_t *stream, int to)
160160
{
161-
return xmp_set_position((xmp_context)stream->priv, to);
161+
const int err = xmp_set_position((xmp_context)stream->priv, to);
162+
switch (err) {
163+
case -XMP_ERROR_STATE:
164+
case -XMP_ERROR_INVALID:
165+
return -1;
166+
}
167+
return 0;
162168
}
163169

164170
static int S_XMP_CodecRewindStream (snd_stream_t *stream)

0 commit comments

Comments
 (0)