Skip to content

Commit

Permalink
Fix panic in in dbaas type show when authorized is nil (#524)
Browse files Browse the repository at this point in the history
This PR fixes unsafe handling of pointers in dbaas type show command.
  • Loading branch information
kobajagi authored Jul 18, 2023
1 parent ecc0736 commit d600de3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/dbaas_type_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ func (c *dbaasTypeShowCmd) cmdRun(_ *cobra.Command, _ []string) error { //nolint
out := make(dbaasTypePlanListOutput, len(dt.Plans))
for i := range dt.Plans {
out[i] = dbaasTypePlanListItemOutput{
Name: *dt.Plans[i].Name,
Nodes: *dt.Plans[i].Nodes,
NodeCPUs: *dt.Plans[i].NodeCPUs,
NodeMemory: *dt.Plans[i].NodeMemory,
DiskSpace: *dt.Plans[i].DiskSpace,
Authorized: *dt.Plans[i].Authorized,
Name: utils.DefaultString(dt.Plans[i].Name, ""),
Nodes: utils.DefaultInt64(dt.Plans[i].Nodes, 0),
NodeCPUs: utils.DefaultInt64(dt.Plans[i].NodeCPUs, 0),
NodeMemory: utils.DefaultInt64(dt.Plans[i].NodeMemory, 0),
DiskSpace: utils.DefaultInt64(dt.Plans[i].DiskSpace, 0),
Authorized: utils.DefaultBool(dt.Plans[i].Authorized, false),
}
}
return c.outputFunc(&out, nil)
Expand Down

0 comments on commit d600de3

Please sign in to comment.