From 070d8325801f300585248f31681c62284086e04e Mon Sep 17 00:00:00 2001 From: bjoern Date: Sun, 26 Mar 2023 19:25:23 +0200 Subject: [PATCH] check against null in dc_backup_provider_unref() (#4232) this is what we're doing in most comparable unref() functions. --- deltachat-ffi/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 63d8d52bf..968616a5d 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -4230,6 +4230,10 @@ pub unsafe extern "C" fn dc_backup_provider_wait(provider: *mut dc_backup_provid #[no_mangle] pub unsafe extern "C" fn dc_backup_provider_unref(provider: *mut dc_backup_provider_t) { + if provider.is_null() { + eprintln!("ignoring careless call to dc_backup_provider_unref()"); + return; + } drop(Box::from_raw(provider)); }