From 5649f223229222f88ae4b278d5d6530079a18fa2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 16 Dec 2009 20:55:19 +0100 Subject: [PATCH] cue_tag: check cd_get_track()!=NULL --- src/cue/cue_tag.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cue/cue_tag.c b/src/cue/cue_tag.c index 94797bd46..3f8fc327e 100644 --- a/src/cue/cue_tag.c +++ b/src/cue/cue_tag.c @@ -175,18 +175,20 @@ struct tag * cue_tag(struct Cd *cd, unsigned tnum) { struct tag *cd_tag, *track_tag; + struct Track *track; assert(cd != NULL); - if (tnum > 256) + track = cd_get_track(cd, tnum); + if (track == NULL) return NULL; /* tag from CDtext info */ cd_tag = cue_tag_cd(cd_get_cdtext(cd), cd_get_rem(cd)); /* tag from TRACKtext info */ - track_tag = cue_tag_track(track_get_cdtext(cd_get_track(cd, tnum)), - track_get_rem(cd_get_track(cd, tnum))); + track_tag = cue_tag_track(track_get_cdtext(track), + track_get_rem(track)); return cue_tag_merge(cd_tag, track_tag); }