From 60ded486c2ccefd6d97f5d109fdea98ee0a6a826 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 21 Dec 2014 13:29:50 +1100 Subject: [PATCH] DataFlash: don't write out parameters if log open fails --- libraries/DataFlash/LogFile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/DataFlash/LogFile.cpp b/libraries/DataFlash/LogFile.cpp index a0abbfc1fa..1e764ca47b 100644 --- a/libraries/DataFlash/LogFile.cpp +++ b/libraries/DataFlash/LogFile.cpp @@ -565,7 +565,10 @@ uint16_t DataFlash_Class::StartNewLog(void) { uint16_t ret; ret = start_new_log(); - + if (ret == 0xFFFF) { + // don't write out parameters if we fail to open the log + return ret; + } // write log formats so the log is self-describing for (uint8_t i=0; i<_num_types; i++) { Log_Write_Format(&_structures[i]);