Fix NPE for rendering and Download Index

This commit is contained in:
Victor Shcherb 2011-03-31 00:27:19 +02:00
parent af61106c7d
commit fb7ae35e32
2 changed files with 7 additions and 6 deletions

View file

@ -565,7 +565,7 @@ public class DownloadIndexActivity extends ListActivity {
}
protected final int TRIES_TO_DOWNLOAD = 20;
protected final int TRIES_TO_DOWNLOAD = 15;
protected final long TIMEOUT_BETWEEN_DOWNLOADS = 8000;
private boolean interruptDownloading = false;
@ -596,7 +596,8 @@ public class DownloadIndexActivity extends ListActivity {
}
conn.setConnectTimeout(30000);
log.info(conn.getResponseMessage() + " " + conn.getResponseCode()); //$NON-NLS-1$
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
if (conn.getResponseCode() != HttpURLConnection.HTTP_PARTIAL &&
conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
conn.disconnect();
triesDownload--;
continue;

View file

@ -196,7 +196,7 @@ public class MapRenderRepositories {
return false;
}
private boolean loadVectorData(RectF dataBox, final int zoom, BaseOsmandRender renderingType){
private boolean loadVectorData(RectF dataBox, final int zoom, final BaseOsmandRender renderingType){
double cBottomLatitude = dataBox.bottom;
double cTopLatitude = dataBox.top;
double cLeftLongitude = dataBox.left;
@ -223,7 +223,7 @@ public class MapRenderRepositories {
int bottomY = MapUtils.get31TileNumberY(cBottomLatitude);
int topY = MapUtils.get31TileNumberY(cTopLatitude);
searchRequest = BinaryMapIndexReader.buildSearchRequest(leftX, rightX, topY, bottomY, zoom);
if (zoom < 15) {
if (zoom < 17) {
searchRequest.setSearchFilter(new BinaryMapIndexReader.SearchFilter() {
@Override
@ -232,7 +232,7 @@ public class MapRenderRepositories {
int type = types.get(j);
int mask = type & 3;
TagValuePair pair = root.decodeType(type);
if (renderingType.isObjectVisible(pair.tag, pair.value, zoom, mask)) {
if (pair != null && renderingType.isObjectVisible(pair.tag, pair.value, zoom, mask)) {
return true;
}
}
@ -328,7 +328,7 @@ public class MapRenderRepositories {
dataBox.top -= hi;
dataBox.bottom += hi;
}
boolean loaded = loadVectorData(dataBox, requestedBox.getZoom(), MapRenderingTypes.getDefault());
boolean loaded = loadVectorData(dataBox, requestedBox.getZoom(), renderingType);
if (!loaded || checkWhetherInterrupted()) {
return;
}