~edwargix/tallyard

1ba0aef385780781f691c40128f0de08e82faa5f — David Florness 2 years ago 0d9ca2b
Ensure we process the start message before processing evals

This is why we've sometimes seen panics when FinalJoinIDs is nil
1 files changed, 9 insertions(+), 1 deletions(-)

M election/msg.go
M election/msg.go => election/msg.go +9 -1
@@ 598,7 598,15 @@ func (elections *ElectionsMap) onEvalsMessage(evt *event.Event) (success bool) {
		return
	}

	// here to find bugs
	if len(content.KeysIDs) == 0 {
		warnf("the key IDs list is empty")
		return
	}

	// process the start message so FinalJoinIDs is set
	elections.EventStore.GetKeysEvent(evt.RoomID, content.KeysIDs[0])

	// should never happen
	if el.FinalJoinIDs == nil {
		errorf("FinalJoinIDs is nil")
		return