From 6dc394880eb77c8e06f7a507558dad48fef8df34 Mon Sep 17 00:00:00 2001 From: Christophe NINUCCI <36405135+chrnin@users.noreply.github.com> Date: Thu, 12 Nov 2020 13:03:23 +0100 Subject: [PATCH] fix nil pointer dereference on follow/xls (#61) --- follow.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/follow.go b/follow.go index f65f279a..d5a52d9b 100644 --- a/follow.go +++ b/follow.go @@ -251,7 +251,11 @@ func (follows Follows) toXLS() ([]byte, Jerror) { row.AddCell().Value = fmt.Sprintf("%s", f.EtablissementSummary.Siret) row.AddCell().Value = fmt.Sprintf("%s", *f.EtablissementSummary.CodeDepartement) row.AddCell().Value = fmt.Sprintf("%s", *f.EtablissementSummary.RaisonSociale) - row.AddCell().Value = fmt.Sprintf("%f", *f.EtablissementSummary.Effectif) + if f.EtablissementSummary.Effectif != nil { + row.AddCell().Value = fmt.Sprintf("%f", *f.EtablissementSummary.Effectif) + } else { + row.AddCell().Value = "" + } row.AddCell().Value = fmt.Sprintf("%s", *f.EtablissementSummary.CodeActivite) row.AddCell().Value = fmt.Sprintf("%s", *f.EtablissementSummary.LibelleActivite) row.AddCell().Value = fmt.Sprintf("%s", *coalescepString(f.EtablissementSummary.Alert, &EmptyString))