diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-08-02 16:31:13 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-08-02 17:37:21 +0800 |
commit | b3070e3608a02a29bfebaced7b84428b143acb5e (patch) | |
tree | cc13ee3f4cb221d0b96b1dc5dc8b148fd88d15a4 | |
parent | 7dea29ad810fbca37cccce76f1b6b28f1ba5db0f (diff) |
sccp_node.c: Do not crash if the first param is of a different type.
-rw-r--r-- | src/sccp_node.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sccp_node.c b/src/sccp_node.c index f546685..75b242c 100644 --- a/src/sccp_node.c +++ b/src/sccp_node.c @@ -58,10 +58,12 @@ int main(int argc, char **argv) { fnp = erl_element(1, tuplep); argp = erl_element(2, tuplep); - if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) { - res = foo(ERL_INT_VALUE(argp)); - } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) { - res = bar(ERL_INT_VALUE(argp)); + if (ERL_IS_ATOM(fnp)) { + if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) { + res = foo(ERL_INT_VALUE(argp)); + } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) { + res = bar(ERL_INT_VALUE(argp)); + } } resp = erl_format("{cnode, ~i}", res); |