aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--binding/afm-mediaplayer-binding.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index 9eea30e..4720b63 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -507,7 +507,15 @@ static void gstreamer_controls(afb_req_t request)
}
case VOLUME_CMD: {
const char *parameter = afb_req_value(request, "volume");
- long int volume = strtol(parameter, NULL, 10);
+ long int volume;
+
+ if (!parameter) {
+ afb_req_fail(request, "failed", "invalid volume");
+ return;
+ }
+
+ volume = strtol(parameter, NULL, 10);
+ errno = 0;
if (volume == 0 && errno) {
afb_req_fail(request, "failed", "invalid volume");