summaryrefslogtreecommitdiff
path: root/tools/btgatt-client.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2014-09-05 17:00:54 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2014-09-05 23:22:02 +0300
commitbfa32744caee0d434c67327c5f33a3a148ae4688 (patch)
tree8838ce07623ff52ca3879399a7c9b82ea980d0c3 /tools/btgatt-client.c
parent8bbd9ed42847fc8f301fc3302b248979b9729bee (diff)
downloadbluez-bfa32744caee0d434c67327c5f33a3a148ae4688.tar.gz
tools/gatt: Fix accessing NULL cmd
Diffstat (limited to 'tools/btgatt-client.c')
-rw-r--r--tools/btgatt-client.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index 3fd492b85..d1395b25d 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -758,6 +758,9 @@ static void prompt_read_cb(int fd, uint32_t events, void *user_data)
if (*cmd != '\0')
break;
+ if (!cmd)
+ goto failed;
+
for (i = 0; command[i].cmd; i++) {
if (strcmp(command[i].cmd, cmd) == 0)
break;
@@ -768,6 +771,7 @@ static void prompt_read_cb(int fd, uint32_t events, void *user_data)
else
fprintf(stderr, "Unknown command: %s\n", line);
+failed:
print_prompt();
free(line);