From 6a4b0fd126c47dcdf49a2effa453d6d402582a3f Mon Sep 17 00:00:00 2001 From: structix Date: Sun, 11 Feb 2018 19:45:40 +0100 Subject: [PATCH] Attempt to suppress file not found error --- sound.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound.c b/sound.c index ae4a0ad..7de67cb 100644 --- a/sound.c +++ b/sound.c @@ -8,7 +8,7 @@ #include "sound.h" #include "config.h" #define BITS 8 - +#include void playSound(const char *path) { pthread_t pth; //thread identifier @@ -20,7 +20,7 @@ void playSound(const char *path) { void *playThreadFunc(void *arg) { const char *path = (const char *) arg; - + if (strlen(path) == 0) return 0; //No input file. Exit. mpg123_handle *mh; unsigned char *buffer; size_t buffer_size; @@ -43,7 +43,7 @@ void *playThreadFunc(void *arg) { buffer = (unsigned char*) malloc(buffer_size * sizeof(unsigned char)); /* open the file and get the decoding format */ - mpg123_open(mh, path); + if (mpg123_open(mh, path) != MPG123_OK) return 0; //File does not exist. exit the function mpg123_getformat(mh, &rate, &channels, &encoding); /* set the output format and open the output device */