From 027f2544e3985ff9b7ddd35c6dfec24404e1dc28 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sat, 21 Oct 2023 22:13:13 -0700 Subject: [PATCH] fix(emoji): hopefully guard against the crash in #3331 --- core/data/emoji.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/data/emoji.go b/core/data/emoji.go index 6b67cd76f..86ea61d50 100644 --- a/core/data/emoji.go +++ b/core/data/emoji.go @@ -45,12 +45,16 @@ func UpdateEmojiList(force bool) (time.Time, error) { if force { emojiCacheModTime = time.Now() } + emojiFS := os.DirFS(config.CustomEmojiPath) + if emojiFS == nil { + return modTime, fmt.Errorf("unable to open custom emoji directory") + } emojiCacheData = make([]models.CustomEmoji, 0) walkFunction := func(path string, d os.DirEntry, err error) error { - if d.IsDir() { + if d == nil || d.IsDir() { return nil }