aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-04-07 13:00:41 +0200
committerfiaxh <git@lightrise.org>2020-04-07 13:06:21 +0200
commitbd8063284c7d3f5f6a2646e91b4f14e87e2765a8 (patch)
tree43bc650f7e5da26615a63e84a1963affd3ebd809
parent5b2683dfa5241777d621866e4e0a0790766433c2 (diff)
downloaddino-bd8063284c7d3f5f6a2646e91b4f14e87e2765a8.tar.gz
dino-bd8063284c7d3f5f6a2646e91b4f14e87e2765a8.zip
Fix runtime criticals when showing resource identites on conversation row hover
-rw-r--r--main/src/ui/conversation_selector/conversation_selector_row.vala13
1 files changed, 8 insertions, 5 deletions
diff --git a/main/src/ui/conversation_selector/conversation_selector_row.vala b/main/src/ui/conversation_selector/conversation_selector_row.vala
index 6dc953df..467bed70 100644
--- a/main/src/ui/conversation_selector/conversation_selector_row.vala
+++ b/main/src/ui/conversation_selector/conversation_selector_row.vala
@@ -254,8 +254,7 @@ public class ConversationSelectorRow : ListBoxRow {
Xep.ServiceDiscovery.Identity? identity = stream_interactor.get_module(EntityInfo.IDENTITY).get_identity(conversation.account, full_jid);
Image image = new Image() { hexpand=false, valign=Align.START, visible=true };
- grid.attach(image, 0, i + 1, 1, 1);
- if (identity != null && identity.type_ == Xep.ServiceDiscovery.Identity.TYPE_PHONE || identity.type_ == Xep.ServiceDiscovery.Identity.TYPE_TABLET) {
+ if (identity != null && (identity.type_ == Xep.ServiceDiscovery.Identity.TYPE_PHONE || identity.type_ == Xep.ServiceDiscovery.Identity.TYPE_TABLET)) {
image.set_from_icon_name("dino-device-phone-symbolic", IconSize.SMALL_TOOLBAR);
} else {
image.set_from_icon_name("dino-device-desktop-symbolic", IconSize.SMALL_TOOLBAR);
@@ -279,12 +278,14 @@ public class ConversationSelectorRow : ListBoxRow {
}
var sb = new StringBuilder();
- if (identity.name != null) {
+ if (identity != null && identity.name != null) {
sb.append(identity.name);
- } else if (dino_resource_regex.match(full_jid.resourcepart)) {
+ } else if (full_jid.resourcepart != null && dino_resource_regex.match(full_jid.resourcepart)) {
sb.append("Dino");
- } else {
+ } else if (full_jid.resourcepart != null) {
sb.append(full_jid.resourcepart);
+ } else {
+ continue;
}
if (status != null) {
sb.append(" <i>(");
@@ -293,6 +294,8 @@ public class ConversationSelectorRow : ListBoxRow {
}
Label resource = new Label(sb.str) { use_markup=true, hexpand=true, xalign=0, visible=true };
+
+ grid.attach(image, 0, i + 1, 1, 1);
grid.attach(resource, 1, i + 1, 1, 1);
}
return grid;