Fix closure in dc_securejoin, make sure we return an empty string and

never null, make dc_get_securejoin_qr return an Option<String> and move
the logic to cast it to c_str into the ffi
This commit is contained in:
jikstra
2019-09-04 16:20:24 +02:00
committed by holger krekel
parent 8fb859c0c4
commit cc2339fbe2
3 changed files with 25 additions and 33 deletions

View File

@@ -1320,12 +1320,11 @@ pub unsafe extern "C" fn dc_get_securejoin_qr(
) -> *mut libc::c_char {
if context.is_null() {
eprintln!("ignoring careless call to dc_get_securejoin_qr()");
return dc_strdup(ptr::null());
"".strdup()
}
let context = &*context;
dc_securejoin::dc_get_securejoin_qr(context, chat_id)
dc_securejoin::dc_get_securejoin_qr(context, chat_id).unwrap_or("").strdup()
}
#[no_mangle]