Skip to content

Commit

Permalink
fix(sdk): check display length (trustbloc#834)
Browse files Browse the repository at this point in the history
The code throws panic when thre is no display data. Added length check before fecthing the first item.

Signed-off-by: Rolson Quadras <[email protected]>
  • Loading branch information
rolsonquadras authored and volodymyr-kit-gen committed Nov 25, 2024
1 parent fa4ab8b commit fc748ad
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/credentialschema/credentialdisplay.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ func getOverviewDisplay(
}
}

if len(credentialConfigurationSupported.LocalizedCredentialDisplays) == 0 {
return &CredentialOverview{}
}

return issuerCredentialDisplayToResolvedCredentialOverview(
&credentialConfigurationSupported.LocalizedCredentialDisplays[0],
)
Expand Down

0 comments on commit fc748ad

Please sign in to comment.