Prevent crash

pull/196/head
M66B 5 years ago
parent 8c2f8e3265
commit fdfaf7357c

@ -219,7 +219,8 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
@Override @Override
protected Boolean onExecute(Context context, Bundle args) { protected Boolean onExecute(Context context, Bundle args) {
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
return (db.identity().getComposableIdentities(null).size() > 0); List<TupleIdentityEx> identities = db.identity().getComposableIdentities(null);
return (identities != null && identities.size() > 0);
} }
@Override @Override

@ -4386,22 +4386,24 @@ class Core {
} }
} }
if (notify_reply && message.content && if (notify_reply && message.content) {
db.identity().getComposableIdentities(message.account).size() > 0) { List<TupleIdentityEx> identities = db.identity().getComposableIdentities(message.account);
Intent reply = new Intent(context, ActivityCompose.class) if (identities != null && identities.size() > 0) {
.putExtra("action", "reply") Intent reply = new Intent(context, ActivityCompose.class)
.putExtra("reference", message.id) .putExtra("action", "reply")
.putExtra("group", group); .putExtra("reference", message.id)
reply.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); .putExtra("group", group);
PendingIntent piReply = PendingIntent.getActivity(context, ActivityCompose.PI_REPLY, reply, PendingIntent.FLAG_UPDATE_CURRENT); reply.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
NotificationCompat.Action.Builder actionReply = new NotificationCompat.Action.Builder( PendingIntent piReply = PendingIntent.getActivity(context, ActivityCompose.PI_REPLY, reply, PendingIntent.FLAG_UPDATE_CURRENT);
R.drawable.twotone_reply_24, NotificationCompat.Action.Builder actionReply = new NotificationCompat.Action.Builder(
context.getString(R.string.title_advanced_notify_action_reply), R.drawable.twotone_reply_24,
piReply) context.getString(R.string.title_advanced_notify_action_reply),
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_REPLY) piReply)
.setShowsUserInterface(true) .setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_REPLY)
.setAllowGeneratedReplies(false); .setShowsUserInterface(true)
mbuilder.addAction(actionReply.build()); .setAllowGeneratedReplies(false);
mbuilder.addAction(actionReply.build());
}
} }
if (notify_reply_direct && if (notify_reply_direct &&

@ -45,6 +45,7 @@ import androidx.preference.PreferenceManager;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class FragmentDialogIdentity extends FragmentDialogBase { public class FragmentDialogIdentity extends FragmentDialogBase {
@ -133,6 +134,9 @@ public class FragmentDialogIdentity extends FragmentDialogBase {
@Override @Override
protected void onExecuted(Bundle args, List<TupleIdentityEx> identities) { protected void onExecuted(Bundle args, List<TupleIdentityEx> identities) {
if (identities == null)
identities = new ArrayList<>();
AdapterIdentitySelect iadapter = new AdapterIdentitySelect(getContext(), identities); AdapterIdentitySelect iadapter = new AdapterIdentitySelect(getContext(), identities);
spIdentity.setAdapter(iadapter); spIdentity.setAdapter(iadapter);

Loading…
Cancel
Save