return error on nil image

This commit is contained in:
Andrea Maria Piana 2020-12-09 17:24:22 +01:00
parent 8663d636d3
commit 69de77c36a
1 changed files with 5 additions and 0 deletions

View File

@ -848,6 +848,11 @@ func (m *MessageHandler) HandleChatIdentity(state *ReceivedMessageState, ci prot
logger.Info(fmt.Sprintf("largest image : name '%s', size '%d'", name, iiSize)) logger.Info(fmt.Sprintf("largest image : name '%s', size '%d'", name, iiSize))
if ci.Images[name] == nil {
logger.Info("image empty")
return errors.New("image empty")
}
dataURI, err := images.GetPayloadDataURI(ci.Images[name].Payload) dataURI, err := images.GetPayloadDataURI(ci.Images[name].Payload)
if err != nil { if err != nil {
return err return err