From eb094473232c38654a65b4f568ecfaf0cfe56001 Mon Sep 17 00:00:00 2001 From: "diamondburned (Forefront)" Date: Thu, 7 May 2020 12:39:47 -0700 Subject: [PATCH] State: Fixed a data race for (*DefaultStore).Messages() --- state/store_default.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/state/store_default.go b/state/store_default.go index dd68d3c..f5dec9f 100644 --- a/state/store_default.go +++ b/state/store_default.go @@ -436,7 +436,9 @@ func (s *DefaultStore) Messages(channelID discord.Snowflake) ([]discord.Message, return nil, ErrStoreNotFound } - return ms, nil + cp := make([]discord.Message, len(ms)) + copy(cp, ms) + return cp, nil } func (s *DefaultStore) MaxMessages() int {