[android][core] additional changes for not initialized place page crash fix. See comment for b1c64f3c38e11111fe9f63fe57ee996fbf56e7a7 with detailed info.

This commit is contained in:
Arsentiy Milchakov 2020-01-13 17:19:13 +03:00 committed by Daria Volvenkova
parent c944c83dbf
commit efdda660ec
3 changed files with 17 additions and 3 deletions

View file

@ -1745,6 +1745,9 @@ Java_com_mapswithme_maps_Framework_nativeZoomToPoint(JNIEnv * env, jclass, jdoub
JNIEXPORT jobject JNICALL
Java_com_mapswithme_maps_Framework_nativeDeleteBookmarkFromMapObject(JNIEnv * env, jclass)
{
if (!frm()->HasPlacePageInfo())
return nullptr;
place_page::Info const & info = g_framework->GetPlacePageInfo();
auto const bookmarkId = info.GetBookmarkId();
frm()->GetBookmarkManager().GetEditSession().DeleteBookmark(bookmarkId);
@ -1761,7 +1764,10 @@ Java_com_mapswithme_maps_Framework_nativeDeleteBookmarkFromMapObject(JNIEnv * en
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_Framework_nativeTurnOnChoosePositionMode(JNIEnv *, jclass, jboolean isBusiness, jboolean applyPosition)
{
g_framework->SetChoosePositionMode(true, isBusiness, applyPosition, applyPosition ? g_framework->GetPlacePageInfo().GetMercator() : m2::PointD());
auto const pos = applyPosition && frm()->HasPlacePageInfo()
? g_framework->GetPlacePageInfo().GetMercator()
: m2::PointD();
g_framework->SetChoosePositionMode(true, isBusiness, applyPosition, pos);
}
JNIEXPORT void JNICALL

View file

@ -1775,6 +1775,11 @@ public class PlacePageView extends NestedScrollView
switch (v.getId())
{
case R.id.ll__place_editor:
if (mMapObject == null)
{
LOGGER.e(TAG, "Cannot start editor, map object is null!");
break;
}
getActivity().showEditor();
break;
case R.id.ll__add_organisation:

View file

@ -4094,8 +4094,11 @@ bool Framework::MakePlacePageForNotification(NotificationCandidate const & notif
buildInfo.m_mercator = featureCenter;
buildInfo.m_featureId = ft.GetID();
m_currentPlacePageInfo = BuildPlacePageInfo(buildInfo);
ActivateMapSelection(m_currentPlacePageInfo);
found = true;
if (m_currentPlacePageInfo)
{
ActivateMapSelection(m_currentPlacePageInfo);
found = true;
}
}
},
rect, scales::GetUpperScale());