Skip to content

Commit

Permalink
fix(dgraph): Fix segmentation fault in draft.go (#5798) (#5860)
Browse files Browse the repository at this point in the history
Use the GetXXX methods of the generated protobufs to correctly handle
the case where no predicate hints are available.

Fixes DGRAPH-1753.
  • Loading branch information
martinmr authored Jul 13, 2020
1 parent 9706b1e commit 37588c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion worker/draft.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func (n *node) applyMutations(ctx context.Context, proposal *pb.Proposal) (rerr
for attr, storageType := range schemaMap {
if _, err := schema.State().TypeOf(attr); err != nil {
hint := pb.Metadata_DEFAULT
if mutHint, ok := proposal.Mutations.Metadata.PredHints[attr]; ok {
if mutHint, ok := proposal.GetMutations().GetMetadata().GetPredHints()[attr]; ok {
hint = mutHint
}
if err := createSchema(attr, storageType, hint); err != nil {
Expand Down

0 comments on commit 37588c0

Please sign in to comment.