You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/07/28 18:20:15 UTC

[2/2] 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/b255dc39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/b255dc39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/b255dc39

Branch: refs/heads/develop
Commit: b255dc392076167499ccb535e37498ea25c74f00
Parents: fab76a5
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Jul 28 11:16:37 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Jul 28 11:19:04 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/b255dc39/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');