From b0502666fde82991ea68bdf71fff3a59ad62908b Mon Sep 17 00:00:00 2001 From: sora233 Date: Thu, 25 May 2023 02:16:31 +0800 Subject: [PATCH] fix npe --- lsp/mmsg/writer.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lsp/mmsg/writer.go b/lsp/mmsg/writer.go index a0d67ce1..967cda86 100644 --- a/lsp/mmsg/writer.go +++ b/lsp/mmsg/writer.go @@ -240,11 +240,11 @@ func (m *MSG) ToMessage(target Target) []*message.SendingMessage { } if lastText != nil { lastText.Content = strings.TrimRightFunc(lastText.Content, unicode.IsSpace) - } - if lastText.Content == "" { - m.Elements = lo.Filter(m.Elements, func(_ message.IMessageElement, index int) bool { - return index != lastIdx - }) + if lastText.Content == "" { + m.Elements = lo.Filter(m.Elements, func(_ message.IMessageElement, index int) bool { + return index != lastIdx + }) + } } } if len(result) > 0 {