Skip to content

fix(data): prevent panic on nil response in checker#308

Open
DEVMANISHOFFL wants to merge 1 commit intoweaviate:mainfrom
DEVMANISHOFFL:fix/panic-on-nil-response
Open

fix(data): prevent panic on nil response in checker#308
DEVMANISHOFFL wants to merge 1 commit intoweaviate:mainfrom
DEVMANISHOFFL:fix/panic-on-nil-response

Conversation

@DEVMANISHOFFL
Copy link

What's being changed:

This PR fixes a nil pointer dereference panic in the Checker.Do method (Issue #299).

When the underlying REST connection fails, such as when it returns a 504 Gateway Timeout or 204 No Content with a nil body in certain edge cases, the responseData object can be nil. Accessing responseData.StatusCode directly led to a panic.

I added a check to ensure that responseData is not nil before accessing it.

Review checklist

  • All new code is covered by tests where it is reasonable.

Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot
Copy link

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

@DEVMANISHOFFL
Copy link
Author

I agree with the CLA.

Comment on lines +44 to +46
// Checking... if responseData is nil before accessing it
// This can happen if the request fails..... e.g. timeout, 504, etc.
if responseData == nil {
Copy link
Collaborator

@bevzzz bevzzz Feb 20, 2026

Choose a reason for hiding this comment

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

In those cases the returned err will be non-nil, so the condition should be err != nil and not responseData == nil.

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.

3 participants