aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2020-03-30 03:15:36 +0200
committercbdev <cb@cbcdn.com>2020-03-30 03:15:36 +0200
commit1891979d878e946941c6f236c3393cae943a4f1d (patch)
tree14cd3ddf6a819475dfe80aba8dde4775f7d66326 /backends
parent3c6d2ccce4dd9be3f6497fb75d0456900e16ab0c (diff)
downloadmidimonster-1891979d878e946941c6f236c3393cae943a4f1d.tar.gz
midimonster-1891979d878e946941c6f236c3393cae943a4f1d.tar.bz2
midimonster-1891979d878e946941c6f236c3393cae943a4f1d.zip
Fix Coverity CID 355268
Diffstat (limited to 'backends')
-rw-r--r--backends/lua.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/backends/lua.c b/backends/lua.c
index e2f3b0e..d7f2643 100644
--- a/backends/lua.c
+++ b/backends/lua.c
@@ -239,10 +239,15 @@ static int lua_callback_output(lua_State* interpreter){
//fetch function parameters
channel_name = lua_tostring(interpreter, 1);
+ if(!channel_name){
+ LOG("Output function called with invalid channel specification");
+ return 0;
+ }
+
val.normalised = clamp(luaL_checknumber(interpreter, 2), 1.0, 0.0);
//if not started yet, create any requested channels so scripts may set them at load time
- if(!last_timestamp && channel_name){
+ if(!last_timestamp){
lua_channel(inst, (char*) channel_name, mmchannel_output);
}
@@ -373,6 +378,10 @@ static int lua_callback_value(lua_State* interpreter, uint8_t input){
//fetch argument
channel_name = lua_tostring(interpreter, 1);
+ if(!channel_name){
+ LOG("get_value function called with invalid channel specification");
+ return 0;
+ }
//find correct channel & return value
for(n = 0; n < data->channels; n++){