From 310a5a6be1ba062b367dad76b86d23a703d2f554 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Apr 2013 13:07:56 +1100 Subject: [PATCH] DataFlash: don't try to write if no card inserted --- libraries/DataFlash/DataFlash_Block.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/DataFlash/DataFlash_Block.cpp b/libraries/DataFlash/DataFlash_Block.cpp index f77cfb3b8a..b2746ca9fa 100644 --- a/libraries/DataFlash/DataFlash_Block.cpp +++ b/libraries/DataFlash/DataFlash_Block.cpp @@ -33,6 +33,9 @@ void DataFlash_Block::FinishWrite(void) void DataFlash_Block::WriteBlock(const void *pBuffer, uint16_t size) { + if (!CardInserted()) { + return; + } while (size > 0) { uint16_t n = df_PageSize - df_BufferIdx; if (n > size) {