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-12-13 15:02:54 +0100
commit60bee26867f53c1fc9be9c58e09b010080338186 (patch)
tree72b00cc4adfc688a1502af6ad2392442291da873 /ctl-lib
parentb6f3b4e2a64aa9a0b2b0626611fdad2fd35686c2 (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;
}