From ec6ae343dd30bd792f51007e35f9d08fefae48b9 Mon Sep 17 00:00:00 2001 From: Avinash Reddy Date: Mon, 24 May 2021 00:51:30 +0530 Subject: Fix crash on encountering VideoMessage (whatsapp) (#1483) * [whatsapp] fix crash on encountering VideoMessage * Update handlers.go * gofmt --- bridge/whatsapp/handlers.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bridge') diff --git a/bridge/whatsapp/handlers.go b/bridge/whatsapp/handlers.go index 8eb02b58..04e44693 100644 --- a/bridge/whatsapp/handlers.go +++ b/bridge/whatsapp/handlers.go @@ -237,6 +237,10 @@ func (b *Bwhatsapp) HandleVideoMessage(message whatsapp.VideoMessage) { return } + if len(fileExt) == 0 { + fileExt = append(fileExt, ".mp4") + } + filename := fmt.Sprintf("%v%v", message.Info.Id, fileExt[0]) b.Log.Debugf("Trying to download %s with size %#v and type %s", filename, message.Length, message.Type) -- cgit v1.2.3