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/07/28 19:51:11 UTC

[2/3] incubator-mynewt-core git commit: console; don't crash if there's console output when console has not been initialized.

console; don't crash if there's console output when console has
not been initialized.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f9020a0f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f9020a0f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f9020a0f

Branch: refs/heads/0_10_0_dev
Commit: f9020a0ff5a7408d1fde3e43985aadd6916b3680
Parents: b65435f
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Jul 28 11:16:37 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Thu Jul 28 12:51:00 2016 -0700

----------------------------------------------------------------------
 libs/console/full/src/cons_tty.c | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f9020a0f/libs/console/full/src/cons_tty.c
----------------------------------------------------------------------
diff --git a/libs/console/full/src/cons_tty.c b/libs/console/full/src/cons_tty.c
index 7dfd0b7..fb2015c 100644
--- a/libs/console/full/src/cons_tty.c
+++ b/libs/console/full/src/cons_tty.c
@@ -165,6 +165,9 @@ console_file_write(void *arg, const char *str, size_t cnt)
     struct console_tty *ct = &console_tty;
     int i;
 
+    if (!ct->ct_write_char) {
+        return cnt;
+    }
     for (i = 0; i < cnt; i++) {
         if (str[i] == '\n') {
             ct->ct_write_char('\r');