From f7e26d1c8d4d6813311ca5202d402dc165387433 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 12 Dec 2024 17:30:12 +0800 Subject: [PATCH] :bug: Fix NPE --- actions/stage/main.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/actions/stage/main.go b/actions/stage/main.go index 9d3d60dd0..af121afb3 100644 --- a/actions/stage/main.go +++ b/actions/stage/main.go @@ -369,13 +369,17 @@ func sanitizePackage(pkg *Package) { pkg.Name = sterilizer.Sanitize(pkg.Name) pkg.Author = sterilizer.Sanitize(pkg.Author) - pkg.DisplayName.Default = sterilizer.Sanitize(pkg.DisplayName.Default) - pkg.DisplayName.ZhCN = sterilizer.Sanitize(pkg.DisplayName.ZhCN) - pkg.DisplayName.EnUS = sterilizer.Sanitize(pkg.DisplayName.EnUS) + if nil != pkg.DisplayName { + pkg.DisplayName.Default = sterilizer.Sanitize(pkg.DisplayName.Default) + pkg.DisplayName.ZhCN = sterilizer.Sanitize(pkg.DisplayName.ZhCN) + pkg.DisplayName.EnUS = sterilizer.Sanitize(pkg.DisplayName.EnUS) + } - pkg.Description.Default = sterilizer.Sanitize(pkg.Description.Default) - pkg.Description.ZhCN = sterilizer.Sanitize(pkg.Description.ZhCN) - pkg.Description.EnUS = sterilizer.Sanitize(pkg.Description.EnUS) + if nil != pkg.Description { + pkg.Description.Default = sterilizer.Sanitize(pkg.Description.Default) + pkg.Description.ZhCN = sterilizer.Sanitize(pkg.Description.ZhCN) + pkg.Description.EnUS = sterilizer.Sanitize(pkg.Description.EnUS) + } } type DisplayName struct {