Skip to content

Add nil check when applying variadic client options #806

Closed
@rajathagasthya

Description

@rajathagasthya

All of the Create, List, Update and Delete client methods are variadic in that it takes any number of options. For example:

Create(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error

It's too easy to pass nil as the last argument for these methods and then it blows up with a NPE in ApplyOptions method. Example:

opt.ApplyToCreate(o)

There needs to be a nil check when options are applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.priority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions