Fix Bug cursor empty and map not initialized

このコミットが含まれているのは:
Schoumi 2017-08-23 16:35:14 +02:00
コミット 43e288ea63
2個のファイルの変更5行の追加2行の削除

ファイルの表示

@ -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)