From cef7f868301ee2d88cbd5f618074eedefdc5ffee Mon Sep 17 00:00:00 2001 From: Vincent Thiberville Date: Wed, 29 Nov 2023 13:30:39 +0100 Subject: [PATCH] doc: update doc example on how to retrieve first memory block --- docs/writingmodules.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/writingmodules.rst b/docs/writingmodules.rst index ac68306b73..bfc7c40ff0 100644 --- a/docs/writingmodules.rst +++ b/docs/writingmodules.rst @@ -657,11 +657,14 @@ checks in your code nevertheless). In those cases you can use the const uint8_t* block_data; block = first_memory_block(context); - block_data = block->fetch_data(block) - - if (block_data != NULL) + if (block != NULL) { - ..do something with the memory block + block_data = block->fetch_data(block) + + if (block_data != NULL) + { + ..do something with the memory block + } } }