Fix possible npe with general router

This commit is contained in:
Vitaliy 2021-02-03 13:40:58 +02:00
parent 638489fcdf
commit 0083b7d0e1

View file

@ -625,11 +625,14 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
private List<RoutingParameter> getReliefParameters() { private List<RoutingParameter> getReliefParameters() {
List<RoutingParameter> reliefFactorParameters = new ArrayList<>(); List<RoutingParameter> reliefFactorParameters = new ArrayList<>();
Map<String, RoutingParameter> parameters = app.getRouter(applicationMode).getParameters(); GeneralRouter router = app.getRouter(applicationMode);
for (Map.Entry<String, RoutingParameter> entry : parameters.entrySet()) { if (router != null) {
RoutingParameter routingParameter = entry.getValue(); Map<String, RoutingParameter> parameters = router.getParameters();
if (RELIEF_SMOOTHNESS_FACTOR.equals(routingParameter.getGroup())) { for (Map.Entry<String, RoutingParameter> entry : parameters.entrySet()) {
reliefFactorParameters.add(routingParameter); RoutingParameter routingParameter = entry.getValue();
if (RELIEF_SMOOTHNESS_FACTOR.equals(routingParameter.getGroup())) {
reliefFactorParameters.add(routingParameter);
}
} }
} }
return reliefFactorParameters; return reliefFactorParameters;