Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 1dc3d2c84 -> 3e4341fc3


MYNEWT-568 - Fix test failures.

Check pointer for null before dereferencing!


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

Branch: refs/heads/develop
Commit: 3e4341fc380d9d56d709f207d1147be42698a4f6
Parents: 1dc3d2c
Author: Christopher Collins <[email protected]>
Authored: Thu Jan 26 19:50:32 2017 -0800
Committer: Christopher Collins <[email protected]>
Committed: Thu Jan 26 19:50:32 2017 -0800

----------------------------------------------------------------------
 sys/log/full/src/log.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/3e4341fc/sys/log/full/src/log.c
----------------------------------------------------------------------
diff --git a/sys/log/full/src/log.c b/sys/log/full/src/log.c
index ab2e827..f9ca59b 100644
--- a/sys/log/full/src/log.c
+++ b/sys/log/full/src/log.c
@@ -196,16 +196,16 @@ log_append(struct log *log, uint16_t module, uint16_t 
level, void *data,
     struct os_timeval tv;
     uint32_t idx;
 
-    if (log->l_log->log_type == LOG_TYPE_STORAGE) {
-        /* Remember that a log entry has been persisted since boot. */
-        log_written = 1;
-    }
-
     if (log->l_name == NULL || log->l_log == NULL) {
         rc = -1;
         goto err;
     }
 
+    if (log->l_log->log_type == LOG_TYPE_STORAGE) {
+        /* Remember that a log entry has been persisted since boot. */
+        log_written = 1;
+    }
+
     /*
      * If the log message is below what this log instance is
      * configured to accept, then just drop it.

Reply via email to