You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/03/04 01:40:33 UTC
[53/70] [abbrv] incubator-mynewt-larva git commit: Fix bug;
crashing on no input.
Fix bug; crashing on no input.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/c7e5c93a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/c7e5c93a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/c7e5c93a
Branch: refs/heads/master
Commit: c7e5c93a93ba3abac04480cd22a0f9ca0c593d98
Parents: 2e28d27
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Mar 1 15:36:44 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Mar 1 15:36:44 2016 -0800
----------------------------------------------------------------------
libs/shell/src/shell.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c7e5c93a/libs/shell/src/shell.c
----------------------------------------------------------------------
diff --git a/libs/shell/src/shell.c b/libs/shell/src/shell.c
index 70ae046..fe5f138 100644
--- a/libs/shell/src/shell.c
+++ b/libs/shell/src/shell.c
@@ -161,7 +161,7 @@ err:
return (rc);
}
-static int
+static int
shell_process_command(char *line, int len)
{
char *tok;
@@ -180,13 +180,14 @@ shell_process_command(char *line, int len)
/* Terminate the argument list with a null pointer. */
argv[argc] = NULL;
- (void) shell_cmd(argv[0], argv, argc);
-
+ if (argc) {
+ (void) shell_cmd(argv[0], argv, argc);
+ }
return (0);
}
-static int
+static int
shell_nlip_process(char *data, int len)
{
uint16_t copy_len;
@@ -367,7 +368,7 @@ err:
return (rc);
}
-static int
+static int
shell_read_console(void)
{
int rc;
@@ -386,7 +387,7 @@ shell_read_console(void)
shell_line_len = 0;
shell_full_line = 0;
if (rc > 2) {
- if (shell_line[0] == SHELL_NLIP_PKT_START1 &&
+ if (shell_line[0] == SHELL_NLIP_PKT_START1 &&
shell_line[1] == SHELL_NLIP_PKT_START2) {
if (g_nlip_mbuf) {
os_mbuf_free_chain(g_nlip_mbuf);
@@ -395,7 +396,7 @@ shell_read_console(void)
g_nlip_expected_len = 0;
rc = shell_nlip_process(&shell_line[2], rc-2);
- } else if (shell_line[0] == SHELL_NLIP_DATA_START1 &&
+ } else if (shell_line[0] == SHELL_NLIP_DATA_START1 &&
shell_line[1] == SHELL_NLIP_DATA_START2) {
rc = shell_nlip_process(&shell_line[2], rc-2);
} else {