Commit e895c860 authored by Schoumi's avatar Schoumi

Fix Bug cursor empty and map not initialized

parent a2082719
Pipeline #66 passed with stage
in 29 seconds
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment