Fix Bug cursor empty and map not initialized
This commit is contained in:
förälder
3a205aa183
incheckning
43e288ea63
|
@ -477,8 +477,9 @@ public class Database extends SQLiteOpenHelper {
|
|||
columns[0] = "latitude";
|
||||
columns[1] = "longitude";
|
||||
Cursor cursor = getReadableDatabase().query("user",columns,null,null,null,null,null);
|
||||
cursor.moveToFirst();
|
||||
LatLng loc = new LatLng(cursor.getDouble(0),cursor.getDouble(1));
|
||||
LatLng loc = new LatLng(0,0);
|
||||
if(cursor.moveToFirst())
|
||||
loc = new LatLng(cursor.getDouble(0),cursor.getDouble(1));
|
||||
cursor.close();
|
||||
return loc;
|
||||
}
|
||||
|
|
|
@ -419,6 +419,8 @@ public class MapsFragment extends Fragment implements OnMapReadyCallback {
|
|||
}
|
||||
|
||||
private LatLng getCorner(CORNER corner) {
|
||||
if(map == null)
|
||||
return new LatLng(0,0);
|
||||
com.car2go.maps.Projection pr = map.getProjection();
|
||||
LatLngBounds bounds = pr.getVisibleRegion().latLngBounds;
|
||||
if(corner == CORNER.TOP_RIGHT)
|
||||
|
|
Laddar…
Referens i nytt ärende