Skip to content

Commit 8059959

Browse files
dcolesskotopes
andauthored
Ensure that furi_record_create is passed a non-NULL data pointer (#4078)
* Ensure that `furi_record_create` is passed a non-NULL data pointer It's currently possible to use `furi_record_create` to create and initialize a `FuriRecordData` pointing to NULL. This means its potentially possible for `furi_record_open` to return a NULL pointer which besides not being particularly useful means the Rust wrapper for `Record` can't assume that the returned record is always a non-NULL value. If by chance this is the intended behaviour, then we can just have the Rust wrapper do a `furi_check` itself, but it seems like it would be better to eliminate this potential corner-case at the source. * Furi: update furi_record_create documentation Co-authored-by: あく <alleteam@gmail.com>
1 parent a2b81e4 commit 8059959

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

furi/core/record.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ bool furi_record_exists(const char* name) {
8080
void furi_record_create(const char* name, void* data) {
8181
furi_check(furi_record);
8282
furi_check(name);
83+
furi_check(data);
8384

8485
furi_record_lock();
8586

furi/core/record.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ bool furi_record_exists(const char* name);
2727
/** Create record
2828
*
2929
* @param name record name
30-
* @param data data pointer
30+
* @param data data pointer (not NULL)
3131
* @note Thread safe. Create and destroy must be executed from the same
3232
* thread.
3333
*/

0 commit comments

Comments
 (0)