mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 23:12:55 +00:00
Prevent crash
This commit is contained in:
parent
53cdce5fa9
commit
767b8ea00e
1 changed files with 5 additions and 0 deletions
|
@ -72,6 +72,9 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||||
public RemoteViews getViewAt(int position) {
|
public RemoteViews getViewAt(int position) {
|
||||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.item_widget_unified);
|
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.item_widget_unified);
|
||||||
|
|
||||||
|
if (position >= messages.size())
|
||||||
|
return views;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TupleMessageWidget message = messages.get(position);
|
TupleMessageWidget message = messages.get(position);
|
||||||
|
|
||||||
|
@ -120,6 +123,8 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position) {
|
||||||
|
if (position >= messages.size())
|
||||||
|
return -1;
|
||||||
return messages.get(position).id;
|
return messages.get(position).id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue