Mercurial > libervia-desktop-kivy
diff cagou/core/share_widget.py @ 383:a90f26e89a4a
share widget: fixed crash when a text content is shared without `text` in data:
sometimes, text content is shared via a path and not directly the `text` key. This is the
case with vCards. This patch fixes share widget to handle this case.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 04 Feb 2020 20:47:17 +0100 |
parents | 4d660b252487 |
children | 415de998b91d |
line wrap: on
line diff
--- a/cagou/core/share_widget.py Tue Feb 04 20:47:17 2020 +0100 +++ b/cagou/core/share_widget.py Tue Feb 04 20:47:17 2020 +0100 @@ -102,7 +102,7 @@ def on_kv_post(self, wid): self.type, self.subtype = self.media_type.split('/') - if self.type == 'text': + if self.type == 'text' and 'text' in self.data: self.preview_box.add_widget(TextPreview(text=self.data['text'])) elif self.type == 'image': self.preview_box.add_widget(ImagePreview(path=self.data['path'])) @@ -126,7 +126,7 @@ G.host.doAction('chat', contact_jid, [profile]) chat_wid = G.host.selected_widget - if self.type == 'text': + if self.type == 'text' and 'text' in self.data: text = self.data['text'] chat_wid.message_input.text += text else: