Commit 79f1ac47 authored by Adrien Béraud's avatar Adrien Béraud

smartlist: fix crash when searching

Change-Id: Id83ff61029299d77d9661f935f3c1d4d41980700
parent 1b7571c3
......@@ -38,6 +38,7 @@ import cx.ring.databinding.ItemSmartlistBinding;
import cx.ring.databinding.ItemSmartlistHeaderBinding;
import cx.ring.utils.ResourceMapper;
import cx.ring.views.AvatarDrawable;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class SmartListViewHolder extends RecyclerView.ViewHolder {
......@@ -65,10 +66,10 @@ public class SmartListViewHolder extends RecyclerView.ViewHolder {
if (binding != null) {
itemView.setOnClickListener(v -> clickListener.onItemClick(smartListViewModel));
compositeDisposable.add(smartListViewModel.getSelected().subscribe(selected -> {
Log.w("SmartListViewHolder", "selected " + selected + " " + smartListViewModel.getContactName());
binding.itemLayout.setActivated(selected);
}));
Observable<Boolean> selected = smartListViewModel.getSelected();
if (selected != null) {
compositeDisposable.add(smartListViewModel.getSelected().subscribe(binding.itemLayout::setActivated));
}
itemView.setOnLongClickListener(v -> {
clickListener.onItemLongClick(smartListViewModel);
return true;
......
......@@ -344,8 +344,13 @@ public class Conversation extends ConversationHistory {
if (interaction.getContact() == null) {
if (mContacts.size() == 1)
interaction.setContact(mContacts.get(0));
else
interaction.setContact(findContact(Uri.fromString(interaction.getAuthor())));
else {
if (interaction.getAuthor() == null) {
Log.e(TAG, "Can't set interaction properties: no author for type:" + interaction.getType() + " id:" + interaction.getId() + " status:" + interaction.mStatus);
} else {
interaction.setContact(findContact(Uri.fromString(interaction.getAuthor())));
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment