diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-05-16 11:44:24 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-12-13 15:02:54 +0100 |
commit | 60bee26867f53c1fc9be9c58e09b010080338186 (patch) | |
tree | 72b00cc4adfc688a1502af6ad2392442291da873 /ctl-lib | |
parent | b6f3b4e2a64aa9a0b2b0626611fdad2fd35686c2 (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.c | 7 |
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; } |