diff --git a/Tests/FrameworkTests/OverwatchTranscriptTests/TranscriptTests.cs b/Tests/FrameworkTests/OverwatchTranscriptTests/TranscriptTests.cs index c5b81ba..255ea17 100644 --- a/Tests/FrameworkTests/OverwatchTranscriptTests/TranscriptTests.cs +++ b/Tests/FrameworkTests/OverwatchTranscriptTests/TranscriptTests.cs @@ -117,10 +117,10 @@ namespace FrameworkTests.OverwatchTranscriptTests var e = events.SingleOrDefault(e => e.Moment.Utc == utc && e.Payload.EventData == data); if (e == null) Assert.Fail("Event not found"); - Assert.That(e.Moment.Utc, Is.EqualTo(utc)); - Assert.That(e.Moment.Duration, Is.EqualTo(duration)); - Assert.That(e.Moment.Index, Is.EqualTo(index)); - Assert.That(e.Payload.EventData, Is.EqualTo(data)); + Assert.That(e!.Moment.Utc, Is.EqualTo(utc)); + Assert.That(e!.Moment.Duration, Is.EqualTo(duration)); + Assert.That(e!.Moment.Index, Is.EqualTo(index)); + Assert.That(e!.Payload.EventData, Is.EqualTo(data)); } private void AssertFileContent() diff --git a/Tools/TranscriptAnalysis/Receivers/BaseReceiver.cs b/Tools/TranscriptAnalysis/Receivers/BaseReceiver.cs index 17e02d7..8ab6a61 100644 --- a/Tools/TranscriptAnalysis/Receivers/BaseReceiver.cs +++ b/Tools/TranscriptAnalysis/Receivers/BaseReceiver.cs @@ -19,18 +19,19 @@ namespace TranscriptAnalysis.Receivers Header = header; } - protected string GetPeerId(int nodeIndex) + protected string? GetPeerId(int nodeIndex) { - return GetIdentity(nodeIndex).PeerId; + return GetIdentity(nodeIndex)?.PeerId; } - protected string GetName(int nodeIndex) + protected string? GetName(int nodeIndex) { - return GetIdentity(nodeIndex).Name; + return GetIdentity(nodeIndex)?.Name; } - protected CodexNodeIdentity GetIdentity(int nodeIndex) + protected CodexNodeIdentity? GetIdentity(int nodeIndex) { + if (nodeIndex < 0) return null; return Header.Nodes[nodeIndex]; } diff --git a/Tools/TranscriptAnalysis/Receivers/LogReplaceReceiver.cs b/Tools/TranscriptAnalysis/Receivers/LogReplaceReceiver.cs index caddc60..d4963ee 100644 --- a/Tools/TranscriptAnalysis/Receivers/LogReplaceReceiver.cs +++ b/Tools/TranscriptAnalysis/Receivers/LogReplaceReceiver.cs @@ -14,6 +14,8 @@ namespace TranscriptAnalysis.Receivers { var peerId = GetPeerId(@event.Payload.NodeIdentity); var name = GetName(@event.Payload.NodeIdentity); + if (peerId == null) return; + if (name == null) return; if (!seen.Contains(peerId)) { diff --git a/Tools/TranscriptAnalysis/Receivers/NodesDegree.cs b/Tools/TranscriptAnalysis/Receivers/NodesDegree.cs index 1677fdf..298d8d1 100644 --- a/Tools/TranscriptAnalysis/Receivers/NodesDegree.cs +++ b/Tools/TranscriptAnalysis/Receivers/NodesDegree.cs @@ -54,6 +54,7 @@ namespace TranscriptAnalysis.Receivers if (@event.Payload.DialSuccessful != null) { var peerId = GetPeerId(@event.Payload.NodeIdentity); + if (peerId == null) return; AddDial(peerId, @event.Payload.DialSuccessful.TargetPeerId); } }