Skip to content

Add nil-check validation in CreateStoreExecute #240

@coderabbitai

Description

@coderabbitai

Description

The CreateStoreExecute method in client/client.go calls request.GetBody().Name without checking whether GetBody() returns nil, which can cause a panic.

Also there are other methods with the same issue - go through them and make sure any that need fixing is fixed.

Recommendation

Add validation to check if request.GetBody() is nil before accessing Name. If nil, return a FgaRequiredParamError with param "body" to provide a graceful error instead of a nil-dereference panic. Add tests to cover the scenarios that body is nil for all relevant methods

References

Location

File: client/client.go
Lines: ~691-705 (CreateStoreExecute function)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Intake

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions