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/09/22 23:29:27 UTC

[3/3] incubator-mynewt-core git commit: console - Don't attempt write if uninitialized.

console - Don't attempt write if uninitialized.


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

Branch: refs/heads/develop
Commit: a7833689ea50889dee3471f02056db8557f9ad12
Parents: 94737de
Author: Christopher Collins <cc...@apache.org>
Authored: Thu Sep 22 16:20:53 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Thu Sep 22 16:29:16 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a7833689/libs/console/full/src/cons_fmt.c
----------------------------------------------------------------------
diff --git a/libs/console/full/src/cons_fmt.c b/libs/console/full/src/cons_fmt.c
index 2b64c01..9995322 100644
--- a/libs/console/full/src/cons_fmt.c
+++ b/libs/console/full/src/cons_fmt.c
@@ -41,6 +41,10 @@ console_printf(const char *fmt, ...)
 {
     va_list args;
 
+    if (!console_is_init()) {
+        return;
+    }
+
     /* Prefix each line with a timestamp. */
     if (!console_is_midline) {
         fprintf((FILE *)&console_file, "%lu:", (unsigned long)os_time_get());
@@ -60,6 +64,10 @@ console_printf(const char *fmt, ...)
     char buf[CONS_OUTPUT_MAX_LINE];
     int len;
 
+    if (!console_is_init()) {
+        return;
+    }
+
     /* Prefix each line with a timestamp. */
     if (!console_is_midline) {
         len = snprintf(buf, sizeof(buf), "%lu:", (unsigned long)os_time_get());