Skip to content

Commit

Permalink
Crash fixing on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed May 30, 2024
1 parent 58ce030 commit 172b34a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,8 @@ pub mod native {
0
}

unsafe fn get_java_string<'a>(env: &'a mut JNIEnv, string: &'a JString) -> Result<&'a str> {
let str_ptr = env.get_string(string)?.as_ptr();
let s: &str = std::ffi::CStr::from_ptr(str_ptr).to_str()?;
Ok(s)
fn get_java_string(env: &mut JNIEnv, string: &JString) -> Result<String> {
Ok(env.get_string(string)?.into())
}

/// # Safety
Expand Down

0 comments on commit 172b34a

Please sign in to comment.