Try to Fix NullPointerException but not sure of the real cause need more investigation

This commit is contained in:
Schoumi 2020-07-09 14:38:43 +02:00
parent 35961d75a9
commit 73239c1328
2 changed files with 10 additions and 2 deletions

View File

@ -53,7 +53,14 @@ public class ApplicationListAdapter extends RecyclerView.Adapter {
private Comparator<ApplicationViewModel> alphaPackageComparator = new Comparator<ApplicationViewModel>() { private Comparator<ApplicationViewModel> alphaPackageComparator = new Comparator<ApplicationViewModel>() {
@Override @Override
public int compare(ApplicationViewModel app1, ApplicationViewModel app2) { public int compare(ApplicationViewModel app1, ApplicationViewModel app2) {
return app1.label.toString().compareToIgnoreCase(app2.label.toString()); if(app1.label != null && app2.label != null)
return app1.label.toString().compareToIgnoreCase(app2.label.toString());
else if(app2.label != null)
return -1;
else if(app1.label != null)
return 1;
else
return 0;
} }
}; };

View File

@ -89,7 +89,8 @@ public class ReportFragment extends Fragment implements Updatable {
@Override @Override
public void onUpdateComplete() { public void onUpdateComplete() {
onUpdateComplete(model); if(model != null)
onUpdateComplete(model);
} }
public void onUpdateComplete(ApplicationViewModel model) { public void onUpdateComplete(ApplicationViewModel model) {