Fix possible npe

This commit is contained in:
Vitaliy 2021-02-02 23:25:45 +02:00
parent d0758f4146
commit 6a38b44e5f
2 changed files with 9 additions and 7 deletions

View file

@ -28,7 +28,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static net.osmand.plus.osmedit.oauth.OsmOAuthHelper.*;
import static net.osmand.plus.osmedit.oauth.OsmOAuthHelper.OsmAuthorizationListener;
/**
* Created by Denis
@ -149,7 +149,9 @@ public class DashOsmEditsFragment extends DashBaseFragment
@Override
public void authorizationCompleted() {
SendPoiBottomSheetFragment.showInstance(getChildFragmentManager(), new OsmPoint[]{selectedPoint});
if (selectedPoint != null) {
SendPoiBottomSheetFragment.showInstance(getChildFragmentManager(), new OsmPoint[] {selectedPoint});
}
}
@Override

View file

@ -5,6 +5,7 @@ import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentManager;
import net.osmand.data.PointDescription;
import net.osmand.osm.PoiType;
@ -54,16 +55,15 @@ public class EditPOIMenuController extends MenuController {
|| !Algorithms.isEmpty(settings.USER_NAME.get())
&& !Algorithms.isEmpty(settings.USER_PASSWORD.get());
FragmentManager fragmentManager = activity.getSupportFragmentManager();
if (point instanceof OpenstreetmapPoint) {
if (isLogged) {
SendPoiBottomSheetFragment.showInstance(activity.getSupportFragmentManager(),
new OsmPoint[]{getOsmPoint()});
SendPoiBottomSheetFragment.showInstance(fragmentManager, new OsmPoint[] {point});
} else {
LoginBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), null);
LoginBottomSheetFragment.showInstance(fragmentManager, null);
}
} else if (point instanceof OsmNotesPoint) {
SendOsmNoteBottomSheetFragment.showInstance(activity.getSupportFragmentManager(),
new OsmPoint[]{getOsmPoint()});
SendOsmNoteBottomSheetFragment.showInstance(fragmentManager, new OsmPoint[] {point});
}
}
}