Skip to content

Commit

Permalink
fix: avoid accessing nil metadata creating credential (#487)
Browse files Browse the repository at this point in the history
  • Loading branch information
javip97 authored Oct 6, 2023
1 parent 48c1e70 commit caa6e8a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/core/services/claims.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ func (c *claim) CreateCredential(ctx context.Context, req *ports.CreateClaimRequ
return nil, ErrLoadingSchema
}

if schema.Metadata == nil {
log.Error(ctx, "schema metadata is nil", "err", ErrProcessSchema)
return nil, ErrProcessSchema
}

jsonLdContext, ok := schema.Metadata.Uris["jsonLdContext"].(string)
if !ok {
log.Error(ctx, "invalid jsonLdContext", "err", ErrJSONLdContext)
Expand Down

0 comments on commit caa6e8a

Please sign in to comment.