Skip to content

Conversation

@usc
Copy link
Contributor

@usc usc commented Jul 30, 2025

fix crash.

java.lang.NullPointerException: Parameter specified as non-null is null: method okhttp3.internal._UtilCommonKt.closeQuietly, parameter
at okhttp3.internal._UtilCommonKt.closeQuietly(Unknown Source:2)
at okhttp3.ResponseBody.close(ResponseBody.kt:195)
at okhttp3.Response.close(Response.kt:343)
at okhttp3.internal._UtilCommonKt.closeQuietly(-UtilCommon.kt:284)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:210)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:530)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1251)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:668)
at java.lang.Thread.run(Thread.java:1012)

Screenshot_2025-07-30-10-37-30-144_com miui thirdappassistant~2

@graycreate graycreate requested a review from Copilot September 13, 2025 13:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a NullPointerException crash that occurs when a network request fails. The crash was caused by returning null from the source() method in an anonymous ResponseBody implementation, which violates OkHttp's non-null parameter requirements.

  • Fixed typo in error message from "Exeception" to "Exception"
  • Replaced null return with proper Buffer() instance in ResponseBody source method
  • Added import for Buffer class and removed unused URISyntaxException import

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

.protocol(Protocol.HTTP_1_1)
.code(404)
.message("Exeception when execute chain.proceed request")
.message("Exception when execute chain.proceed request")
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message has grammatical issues. Consider changing to 'Exception when executing chain.proceed request' or 'Exception occurred while executing chain.proceed request' for better clarity.

Suggested change
.message("Exception when execute chain.proceed request")
.message("Exception when executing chain.proceed request")

Copilot uses AI. Check for mistakes.
@graycreate
Copy link
Member

这个问题已经在主分支上修复了。

具体修复情况:

  • 在 PR fix: handle null ResponseBody source in network interceptor #107 (commit cc8a7cd) 中已经修复了 NullPointerException 问题
  • 使用 ResponseBody.create() 替换了自定义的 ResponseBody 匿名类,确保返回有效的 BufferedSource 而不是 null
  • 刚刚在 commit d2bc69d 中修复了拼写错误 'Exeception' -> 'Exception'
  • 同时清理了未使用的 URISyntaxException 导入

问题已解决,关闭此 PR。感谢贡献!

@graycreate
Copy link
Member

Issue has been resolved in the main branch via PR #107.

@graycreate graycreate closed this Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants