Prevent no caption in an image from crashing transwhat
This commit is contained in:
parent
1c0ae79ec2
commit
dbb66e0381
|
@ -7,7 +7,7 @@ import logging
|
||||||
import google.protobuf
|
import google.protobuf
|
||||||
|
|
||||||
def WRAP(MESSAGE, TYPE):
|
def WRAP(MESSAGE, TYPE):
|
||||||
wrap = protocol_pb2.WrapperMessage()
|
wrap = protocol_pb2.WrapperMessage()
|
||||||
wrap.type = TYPE
|
wrap.type = TYPE
|
||||||
wrap.payload = MESSAGE
|
wrap.payload = MESSAGE
|
||||||
return wrap.SerializeToString()
|
return wrap.SerializeToString()
|
||||||
|
|
|
@ -318,6 +318,8 @@ class Session(YowsupApp):
|
||||||
def onImage(self, image):
|
def onImage(self, image):
|
||||||
self.logger.debug('Received image message %s', str(image))
|
self.logger.debug('Received image message %s', str(image))
|
||||||
buddy = image._from.split('@')[0]
|
buddy = image._from.split('@')[0]
|
||||||
|
if image.caption is None:
|
||||||
|
image.caption = ''
|
||||||
message = image.url + ' ' + image.caption
|
message = image.url + ' ' + image.caption
|
||||||
self.sendMessageToXMPP(buddy, message, image.timestamp)
|
self.sendMessageToXMPP(buddy, message, image.timestamp)
|
||||||
self.sendReceipt(image._id, image._from, None, image.participant)
|
self.sendReceipt(image._id, image._from, None, image.participant)
|
||||||
|
|
Loading…
Reference in a new issue