From 1e34bdac1ff03624bd6b7f7d9db0364444f99be7 Mon Sep 17 00:00:00 2001 From: Claudio Costa Date: Wed, 23 Sep 2020 08:51:12 +0200 Subject: [PATCH] Fix possible nil dereference (#15435) Co-authored-by: Mattermod --- app/admin.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/admin.go b/app/admin.go index 245753f72e..c340a30143 100644 --- a/app/admin.go +++ b/app/admin.go @@ -26,11 +26,15 @@ func (s *Server) GetLogs(page, perPage int) ([]string, *model.AppError) { license := s.License() if license != nil && *license.Features.Cluster && s.Cluster != nil && *s.Config().ClusterSettings.Enable { - lines = append(lines, "-----------------------------------------------------------------------------------------------------------") - lines = append(lines, "-----------------------------------------------------------------------------------------------------------") - lines = append(lines, s.Cluster.GetMyClusterInfo().Hostname) - lines = append(lines, "-----------------------------------------------------------------------------------------------------------") - lines = append(lines, "-----------------------------------------------------------------------------------------------------------") + if info := s.Cluster.GetMyClusterInfo(); info != nil { + lines = append(lines, "-----------------------------------------------------------------------------------------------------------") + lines = append(lines, "-----------------------------------------------------------------------------------------------------------") + lines = append(lines, info.Hostname) + lines = append(lines, "-----------------------------------------------------------------------------------------------------------") + lines = append(lines, "-----------------------------------------------------------------------------------------------------------") + } else { + mlog.Error("Could not get cluster info") + } } melines, err := s.GetLogsSkipSend(page, perPage)