From 69de77c36a21b8c1c8c68b14b857f9e66ba634a9 Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Wed, 9 Dec 2020 17:24:22 +0100 Subject: [PATCH] return error on nil image --- protocol/message_handler.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/protocol/message_handler.go b/protocol/message_handler.go index 03b5f0100..6bd96959b 100644 --- a/protocol/message_handler.go +++ b/protocol/message_handler.go @@ -848,6 +848,11 @@ func (m *MessageHandler) HandleChatIdentity(state *ReceivedMessageState, ci prot 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) if err != nil { return err