goharbor / goharbor/harbor-cli

[bug]: nil pointer panic when deleting non-existent project robot

Open
#891 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
163
Forks
211
Avg merge
1m
Merged PRs (30d)
1

Description

## Description

Running `harbor project robot delete ` with a non-existent robot name causes a nil pointer panic.

The command prints the error from `GetRobotByName()` but continues execution and later crashes while accessing `robot.ID`.

## Steps to Reproduce

1. Run command: `harbor project robot delete non-existent-robot`
2. Use any invalid robot name
3. Observe the nil pointer panic

## Expected Behavior

The command should return the error gracefully without crashing.

## Actual Behavior

The CLI prints the error and then crashes with a nil pointer dereference panic.

## Environment

* OS: Any
* Tool version: harbor-cli main branch
* Other relevant details: Happens when the robot name does not exist

## Additional Context

Fix proposed in PR #890.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.