Skip to content

fix: guard against nil role in permissions.ls#3840

Merged
tenthirtyam merged 1 commit intomainfrom
fix/guard-against-nil
Aug 20, 2025
Merged

fix: guard against nil role in permissions.ls#3840
tenthirtyam merged 1 commit intomainfrom
fix/guard-against-nil

Conversation

@tenthirtyam
Copy link
Copy Markdown
Contributor

Description

Safely handle cases where the role may not exist by defaulting to the role ID as a string, and only using the role name if it is present.

Updates the role name display in func (l *List) Write(w io.Writer) error in cli/permissions/permissions.go, preventing potential nil pointer errors by falling back to the role ID when the role is not found.

Closes #3833

Adds a check to prevent panic when RoleId lookup returns nil in the permissions list output. Falls back to displaying the RoleId as a string if the role is not found.

Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
@tenthirtyam tenthirtyam self-assigned this Aug 20, 2025
@tenthirtyam tenthirtyam requested a review from dougm August 20, 2025 17:14
Copy link
Copy Markdown
Member

@dougm dougm left a comment

Choose a reason for hiding this comment

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

Thanks @tenthirtyam

@tenthirtyam tenthirtyam merged commit e481fdd into main Aug 20, 2025
11 checks passed
@tenthirtyam tenthirtyam deleted the fix/guard-against-nil branch November 27, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

panic on permissions.ls

2 participants