Prevent no caption in an image from crashing transwhat

This commit is contained in:
moyamo 2015-11-05 17:57:16 +02:00
parent 1c0ae79ec2
commit dbb66e0381
2 changed files with 3 additions and 1 deletions

View File

@ -7,7 +7,7 @@ import logging
import google.protobuf
def WRAP(MESSAGE, TYPE):
wrap = protocol_pb2.WrapperMessage()
wrap = protocol_pb2.WrapperMessage()
wrap.type = TYPE
wrap.payload = MESSAGE
return wrap.SerializeToString()

View File

@ -318,6 +318,8 @@ class Session(YowsupApp):
def onImage(self, image):
self.logger.debug('Received image message %s', str(image))
buddy = image._from.split('@')[0]
if image.caption is None:
image.caption = ''
message = image.url + ' ' + image.caption
self.sendMessageToXMPP(buddy, message, image.timestamp)
self.sendReceipt(image._id, image._from, None, image.participant)