aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-10-17 11:58:14 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2017-10-17 11:58:27 -0700
commitac277ae6c0c278fbbe11b176e3324bd4d7337332 (patch)
tree55180d2dc1d76f12bba7af1157d0c487b6bbac53
parenta6d08a5739649adabc574b016ef7cf192b997fa2 (diff)
binding: mediaplayer: fix segfault possiblity
If there is no playlist the seek track commands will segfault Bug-AGL: SPEC-931 Change-Id: I877ca12f9adbb17bfd7959b21e3478b2d0260fc2 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--binding/afm-mediaplayer-binding.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index 56213cb..10580e3 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -228,9 +228,14 @@ static void audio_playlist(struct afb_req request)
static int seek_track(int cmd)
{
- GList *item = (cmd == NEXT_CMD) ? current_track->next : current_track->prev;
+ GList *item = NULL;
int ret;
+ if (current_track == NULL)
+ return -EINVAL;
+
+ item = (cmd == NEXT_CMD) ? current_track->next : current_track->prev;
+
if (item == NULL)
return -EINVAL;