Fix issue 331 and issue 306

This commit is contained in:
Victor Shcherb 2011-01-24 00:32:16 +01:00
parent 4c6fb0bf77
commit 5fbe56c00f

View file

@ -329,7 +329,7 @@ public class BinaryMapIndexWriter {
}
int restrictionsSize = 0;
if(restrictions.length > 0){
if(restrictions != null && restrictions.length > 0){
allSize += CodedOutputStream.computeTagSize(OsmandOdb.MapData.RESTRICTIONS_FIELD_NUMBER);
for (int i = 0; i < restrictions.length / 8; i++) {
long l = Algoritms.parseLongFromBytes(restrictions, i * 8) - stackBaseIds.peek();
@ -376,7 +376,7 @@ public class BinaryMapIndexWriter {
codedOutStream.writeUInt32(OsmandOdb.MapData.STRINGID_FIELD_NUMBER, nameId);
}
if(restrictions.length > 0){
if(restrictions != null && restrictions.length > 0){
codedOutStream.writeTag(OsmandOdb.MapData.RESTRICTIONS_FIELD_NUMBER, WireFormat.FieldType.BYTES.getWireType());
codedOutStream.writeRawVarint32(restrictionsSize);
for (int i = 0; i < restrictions.length / 8; i++) {