Merge pull request #9176 from osmandapp/fix_errors
Try to fix possible npe
This commit is contained in:
commit
aaf2aa06d3
2 changed files with 9 additions and 6 deletions
|
@ -128,7 +128,8 @@ public class EditPoiData {
|
||||||
if (oldValue == null || !oldValue.equals(value)) {
|
if (oldValue == null || !oldValue.equals(value)) {
|
||||||
changedTags.add(tag);
|
changedTags.add(tag);
|
||||||
}
|
}
|
||||||
tagValues.put(tag, value);
|
String tagVal = value != null ? value : "";
|
||||||
|
tagValues.put(tag, tagVal);
|
||||||
notifyDatasetChanged(tag);
|
notifyDatasetChanged(tag);
|
||||||
} finally {
|
} finally {
|
||||||
isInEdit = false;
|
isInEdit = false;
|
||||||
|
@ -207,7 +208,8 @@ public class EditPoiData {
|
||||||
public void updateTypeTag(String string, boolean userChanges) {
|
public void updateTypeTag(String string, boolean userChanges) {
|
||||||
checkNotInEdit();
|
checkNotInEdit();
|
||||||
try {
|
try {
|
||||||
tagValues.put(POI_TYPE_TAG, string);
|
String val = string != null ? string : "";
|
||||||
|
tagValues.put(POI_TYPE_TAG, val);
|
||||||
if (userChanges) {
|
if (userChanges) {
|
||||||
changedTags.add(POI_TYPE_TAG);
|
changedTags.add(POI_TYPE_TAG);
|
||||||
}
|
}
|
||||||
|
@ -216,7 +218,8 @@ public class EditPoiData {
|
||||||
if (pt != null) {
|
if (pt != null) {
|
||||||
removeTypeTagWithPrefix(!tagValues.containsKey(REMOVE_TAG_PREFIX + pt.getEditOsmTag()));
|
removeTypeTagWithPrefix(!tagValues.containsKey(REMOVE_TAG_PREFIX + pt.getEditOsmTag()));
|
||||||
currentPoiType = pt;
|
currentPoiType = pt;
|
||||||
tagValues.put(pt.getEditOsmTag(), pt.getEditOsmValue());
|
String tagVal = pt.getEditOsmValue() != null ? pt.getEditOsmValue() : "";
|
||||||
|
tagValues.put(pt.getEditOsmTag(), tagVal);
|
||||||
if (userChanges) {
|
if (userChanges) {
|
||||||
changedTags.add(pt.getEditOsmTag());
|
changedTags.add(pt.getEditOsmTag());
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,6 @@ import net.osmand.osm.edit.OSMSettings;
|
||||||
import net.osmand.osm.edit.Way;
|
import net.osmand.osm.edit.Way;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -75,6 +74,7 @@ import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||||
import net.osmand.plus.osmedit.OsmPoint.Action;
|
import net.osmand.plus.osmedit.OsmPoint.Action;
|
||||||
import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment;
|
import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment;
|
||||||
import net.osmand.plus.osmedit.dialogs.PoiTypeDialogFragment;
|
import net.osmand.plus.osmedit.dialogs.PoiTypeDialogFragment;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -465,8 +465,8 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String isTextLengthInRange() {
|
private String isTextLengthInRange() {
|
||||||
for (Entry<String, String> s: editPoiData.getTagValues().entrySet()) {
|
for (Entry<String, String> s : editPoiData.getTagValues().entrySet()) {
|
||||||
if (s.getValue().length() > AMENITY_TEXT_LENGTH) {
|
if (!Algorithms.isEmpty(s.getValue()) && s.getValue().length() > AMENITY_TEXT_LENGTH) {
|
||||||
return s.getKey();
|
return s.getKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue