Crash fixes

This commit is contained in:
Grishka 2024-11-05 20:45:49 +03:00
parent 162bc86ebe
commit c60d06950f
4 changed files with 14 additions and 7 deletions

View File

@ -148,7 +148,7 @@ public class CacheController{
.map(ng->{
NotificationViewModel nvm=new NotificationViewModel();
nvm.notification=ng;
nvm.accounts=ng.sampleAccountIds.stream().map(accounts::get).collect(Collectors.toList());
nvm.accounts=ng.sampleAccountIds.stream().map(accounts::get).filter(Objects::nonNull).collect(Collectors.toList());
if(nvm.accounts.size()!=ng.sampleAccountIds.size())
return null;
if(ng.statusId!=null){

View File

@ -165,7 +165,10 @@ public class NotificationsListFragment extends BaseNotificationsListFragment{
for(int i=0;i<parent.getChildCount();i++){
View child=parent.getChildAt(i);
if(parent.getChildViewHolder(child) instanceof StatusDisplayItem.Holder<?> holder){
String itemID=getNotificationByID(holder.getItemID()).notification.pageMaxId;
NotificationViewModel n=getNotificationByID(holder.getItemID());
if(n==null)
continue;
String itemID=n.notification.pageMaxId;
if(ObjectIdComparator.INSTANCE.compare(itemID, unreadMarker)>0){
parent.getDecoratedBoundsWithMargins(child, tmpRect);
c.drawRect(tmpRect, paint);

View File

@ -131,7 +131,7 @@ public class AccountActivationFragment extends ToolbarFragment{
private void onOpenEmailClick(View v){
try{
startActivity(Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, Intent.CATEGORY_APP_EMAIL).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}catch(ActivityNotFoundException x){
}catch(ActivityNotFoundException|IllegalArgumentException x){
Toast.makeText(getActivity(), R.string.no_app_to_handle_action, Toast.LENGTH_SHORT).show();
}
}

View File

@ -209,19 +209,23 @@ public class MediaGridStatusDisplayItem extends StatusDisplayItem{
@Override
public void setImage(int index, Drawable drawable){
if(index<controllers.size())
controllers.get(index).setImage(drawable);
}
@Override
public void clearImage(int index){
if(index<controllers.size())
controllers.get(index).clearImage();
}
@Override
public void onImageLoadingFailed(int index, Throwable error){
if(index<controllers.size()){
controllers.get(index).showFailedOverlay();
thereAreFailedImages=true;
}
}
private void onViewClick(View v){
int index=(Integer)v.getTag();