summaryrefslogtreecommitdiffstats
path: root/ctl-lib
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-05-16 11:44:24 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-05-16 11:45:15 +0200
commitbe14d7d76c078c7d755291266851cdc6edbd2e6d (patch)
tree72b00cc4adfc688a1502af6ad2392442291da873 /ctl-lib
parent5dac4e9dc283879b359d94a0ec5f69572e59650d (diff)
Fix: arguments pointer NULL check
Change-Id: I666136b1f1fb21d223fa16f299de2ce5430a0c7e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib')
-rw-r--r--ctl-lib/ctl-action.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ctl-lib/ctl-action.c b/ctl-lib/ctl-action.c
index ce9b2b8..e7c3361 100644
--- a/ctl-lib/ctl-action.c
+++ b/ctl-lib/ctl-action.c
@@ -27,9 +27,12 @@
#include "ctl-config.h"
int ActionLabelToIndex(CtlActionT*actions, const char* actionLabel) {
- for (int idx = 0; actions[idx].uid; idx++) {
- if (!strcasecmp(actionLabel, actions[idx].uid)) return idx;
+ if (actions) {
+ for (int idx = 0; actions[idx].uid; idx++) {
+ if (!strcasecmp(actionLabel, actions[idx].uid)) return idx;
+ }
}
+
return -1;
}