Skip to content

Commit

Permalink
fix(android): handle request freezes due to wrong usage of iterator (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Aug 16, 2023
1 parent b5e1875 commit 70d8ae0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/fix-endless-loop-handle-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Fixes Android freezing when handling request due to endless iteration when reading request headers.
3 changes: 2 additions & 1 deletion src/webview/android/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ fn handle_request(env: &mut JNIEnv, request: JObject) -> Result<jobject, JniErro
.call_method(request, "getRequestHeaders", "()Ljava/util/Map;", &[])?
.l()?;
let request_headers = JMap::from_env(env, &request_headers)?;
while let Some((header, value)) = request_headers.iter(env)?.next(env)? {
let mut iter = request_headers.iter(env)?;
while let Some((header, value)) = iter.next(env)? {
let header = JString::from(header);
let value = JString::from(value);
let header = env.get_string(&header)?;
Expand Down

0 comments on commit 70d8ae0

Please sign in to comment.