BugFix Picking da ordine: errore in caso di lista commesse vuota

This commit is contained in:
Valerio Castellana 2023-02-14 12:19:16 +01:00
parent 7678ce1a50
commit 5eac3f14cc

View File

@ -915,8 +915,6 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
}
private void initJtbComtCache(Runnable onComplete) {
if (this.mViewModel.getOrderList().getValue() == null) {
this.jtbComtCache = new ArrayList<>();
@ -925,8 +923,15 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
}
var jtbComts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
.flatMap(x -> Stream.of(x.getCodJcom()))
.distinct().withoutNulls()
.toList();
if (jtbComts.isEmpty()) {
this.jtbComtCache = new ArrayList<>();
onComplete.run();
return;
}
this.mCommessaRESTConsumer.getJtbComts(jtbComts, jtbComtCache -> {
this.jtbComtCache = jtbComtCache;
onComplete.run();