[MM-52922] Fix a possible nil call to subscription.LastInvoice (#23540)
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -198,12 +198,17 @@ func (a *App) SendUpgradeConfirmationEmail(isYearly bool) *model.AppError {
|
|||||||
|
|
||||||
embeddedFiles := make(map[string]io.Reader)
|
embeddedFiles := make(map[string]io.Reader)
|
||||||
if isYearly {
|
if isYearly {
|
||||||
pdf, filename, pdfErr := a.Cloud().GetInvoicePDF("", subscription.LastInvoice.ID)
|
lastInvoice := subscription.LastInvoice
|
||||||
if pdfErr != nil {
|
if lastInvoice == nil {
|
||||||
a.Log().Error("Error retrieving the invoice for subscription id", mlog.String("subscription", subscription.ID), mlog.Err(pdfErr))
|
a.Log().Error("Last invoice not defined for the subscription", mlog.String("subscription", subscription.ID))
|
||||||
} else {
|
} else {
|
||||||
embeddedFiles = map[string]io.Reader{
|
pdf, filename, pdfErr := a.Cloud().GetInvoicePDF("", lastInvoice.ID)
|
||||||
filename: bytes.NewReader(pdf),
|
if pdfErr != nil {
|
||||||
|
a.Log().Error("Error retrieving the invoice for subscription id", mlog.String("subscription", subscription.ID), mlog.Err(pdfErr))
|
||||||
|
} else {
|
||||||
|
embeddedFiles = map[string]io.Reader{
|
||||||
|
filename: bytes.NewReader(pdf),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user