Fix NPE
This commit is contained in:
parent
1f5af8ba34
commit
b077081d2f
1 changed files with 12 additions and 12 deletions
|
@ -10,7 +10,6 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.FavouritePoint;
|
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -35,7 +34,6 @@ import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.BaseExpandableListAdapter;
|
import android.widget.BaseExpandableListAdapter;
|
||||||
|
@ -44,7 +42,6 @@ import android.widget.CheckBox;
|
||||||
import android.widget.ExpandableListView;
|
import android.widget.ExpandableListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
|
||||||
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
|
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
|
||||||
|
|
||||||
public class LocalIndexesActivity extends ExpandableListActivity {
|
public class LocalIndexesActivity extends ExpandableListActivity {
|
||||||
|
@ -84,16 +81,19 @@ public class LocalIndexesActivity extends ExpandableListActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||||
long packedPos = ((ExpandableListContextMenuInfo)menuInfo).packedPosition;
|
long packedPos = ((ExpandableListContextMenuInfo)menuInfo).packedPosition;
|
||||||
|
int group = ExpandableListView.getPackedPositionGroup(packedPos);
|
||||||
final LocalIndexInfo point = (LocalIndexInfo) listAdapter.getChild(ExpandableListView.getPackedPositionGroup(packedPos),
|
int child = ExpandableListView.getPackedPositionChild(packedPos);
|
||||||
ExpandableListView.getPackedPositionChild(packedPos));
|
if (child >= 0 && group >= 0) {
|
||||||
if(point.getGpxFile() != null){
|
final LocalIndexInfo point = (LocalIndexInfo) listAdapter.getChild(group, child);
|
||||||
Location loc = point.getGpxFile().findFistLocation();
|
if (point != null && point.getGpxFile() != null) {
|
||||||
if(loc != null){
|
Location loc = point.getGpxFile().findFistLocation();
|
||||||
OsmandSettings.getOsmandSettings(LocalIndexesActivity.this).setMapLocationToShow(loc.getLatitude(),loc.getLongitude());
|
if (loc != null) {
|
||||||
|
OsmandSettings.getOsmandSettings(LocalIndexesActivity.this).setMapLocationToShow(loc.getLatitude(),
|
||||||
|
loc.getLongitude());
|
||||||
|
}
|
||||||
|
((OsmandApplication) getApplication()).setGpxFileToDisplay(point.getGpxFile());
|
||||||
|
MapActivity.launchMapActivityMoveToTop(LocalIndexesActivity.this);
|
||||||
}
|
}
|
||||||
((OsmandApplication) getApplication()).setGpxFileToDisplay(point.getGpxFile());
|
|
||||||
MapActivity.launchMapActivityMoveToTop(LocalIndexesActivity.this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue