[search] Fix crash when searching coordinates

Signed-off-by: David Martinez <47610359+dvdmrtnz@users.noreply.github.com>
This commit is contained in:
David Martinez 2024-01-17 23:44:46 +01:00 committed by Viktor Govako
parent 394d7d0014
commit 2360958ac5
2 changed files with 5 additions and 2 deletions

View file

@ -111,7 +111,7 @@ jobject ToJavaResult(Result const & result, search::ProductInfo const & productI
jni::TScopedLocalRef featureType(env, jni::ToJavaString(env, localizedType));
jni::TScopedLocalRef address(env, jni::ToJavaString(env, result.GetAddress()));
jni::TScopedLocalRef dist(env, ToJavaDistance(env, distance));
jni::TScopedLocalRef description(env, jni::ToJavaString(env, result.GetFeatureDescription()));
jni::TScopedLocalRef description(env, jni::ToJavaString(env, isFeature ? result.GetFeatureDescription() : ""));
jni::TScopedLocalRef desc(env, env->NewObject(g_descriptionClass, g_descriptionConstructor,
featureId.get(), featureType.get(), address.get(),

View file

@ -32,7 +32,10 @@
self.locationLabel.text = @(result.GetAddress().c_str());
[self.locationLabel sizeToFit];
self.infoLabel.text = @(result.GetFeatureDescription().c_str());
if (result.GetResultType() == search::Result::Type::Feature)
self.infoLabel.text = @(result.GetFeatureDescription().c_str());
else
self.infoLabel.text = @("");
CLLocation * lastLocation = [MWMLocationManager lastLocation];
double distanceInMeters = 0.0;