Skip to content

Commit

Permalink
Fix nil pointer in diagnostic API if a message is not booked (#1144)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonastheis authored Mar 27, 2021
1 parent 840aa12 commit 1341ed9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions plugins/webapi/tools/message/diagnostic_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,16 @@ func getDiagnosticMessageInfo(messageID tangle.MessageID) *DiagnosticMessagesInf
msgInfo.Booked = metadata.IsBooked()
msgInfo.Eligible = metadata.IsEligible()
msgInfo.Invalid = metadata.IsInvalid()
msgInfo.Rank = metadata.StructureDetails().Rank
msgInfo.IsPastMarker = metadata.StructureDetails().IsPastMarker
msgInfo.PastMarkers = metadata.StructureDetails().PastMarkers.SequenceToString()
msgInfo.PMHI = uint64(metadata.StructureDetails().PastMarkers.HighestIndex())
msgInfo.PMLI = uint64(metadata.StructureDetails().PastMarkers.LowestIndex())
msgInfo.FutureMarkers = metadata.StructureDetails().FutureMarkers.SequenceToString()
msgInfo.FMHI = uint64(metadata.StructureDetails().FutureMarkers.HighestIndex())
msgInfo.FMLI = uint64(metadata.StructureDetails().FutureMarkers.LowestIndex())
if metadata.StructureDetails() != nil {
msgInfo.Rank = metadata.StructureDetails().Rank
msgInfo.IsPastMarker = metadata.StructureDetails().IsPastMarker
msgInfo.PastMarkers = metadata.StructureDetails().PastMarkers.SequenceToString()
msgInfo.PMHI = uint64(metadata.StructureDetails().PastMarkers.HighestIndex())
msgInfo.PMLI = uint64(metadata.StructureDetails().PastMarkers.LowestIndex())
msgInfo.FutureMarkers = metadata.StructureDetails().FutureMarkers.SequenceToString()
msgInfo.FMHI = uint64(metadata.StructureDetails().FutureMarkers.HighestIndex())
msgInfo.FMLI = uint64(metadata.StructureDetails().FutureMarkers.LowestIndex())
}

branchID = metadata.BranchID()
}, false)
Expand Down

0 comments on commit 1341ed9

Please sign in to comment.