From 221c4954324e78299cf27ca15fb8f78a24550e53 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 20 Jun 2014 04:54:18 -0400 Subject: Fix a playback bug in shink_callback() Invalid event data would be accessed if a play message isn't queued which will cause crash problems. It came about in the addition of time-based resume. Change-Id: I1d5219064e2bf552b4183e9db4e7b380ffbe7a67 --- apps/playback.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/playback.c b/apps/playback.c index eba90f9a0a..efc23306a0 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -842,9 +842,10 @@ static int shrink_callback(int handle, unsigned hints, void* start, size_t old_s bool play_queued = queue_peek_ex(&audio_queue, &ev, QPEEK_REMOVE_EVENTS, filter_list); - if (playing && ev.data != (intptr_t)&resume) + if (playing && (elapsed > 0 || offset > 0)) { - resume = *(struct audio_resume_info *)ev.data; + if (play_queued) + resume = *(struct audio_resume_info *)ev.data; /* current id3->elapsed/offset are king */ if (elapsed > 0) -- cgit v1.2.3