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/c092a8a9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/c092a8a9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/c092a8a9 Branch: refs/heads/sterly_refactor Commit: c092a8a9545fd80e84fd72f7d895d7e6446458c7 Parents: cf90249 Author: Marko Kiiskila <[email protected]> Authored: Thu Jul 28 11:16:37 2016 -0700 Committer: Sterling Hughes <[email protected]> Committed: Sun Jul 31 21:58:57 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/c092a8a9/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');
