From bfc944e30aee8e83046d016e8c447847ac556c76 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Thu, 2 May 2019 16:26:33 -0700 Subject: [PATCH] Fix two potential exceptions and one lint warning --- modules/core/validator.js | 3 ++- modules/validations/close_nodes.js | 2 +- modules/validations/disconnected_way.js | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/core/validator.js b/modules/core/validator.js index a0014eb2d..e85240e3d 100644 --- a/modules/core/validator.js +++ b/modules/core/validator.js @@ -314,7 +314,8 @@ export function coreValidator(context) { // detect new issues and update caches entityIDsToCheck.forEach(function(entityID) { - var entity = graph.entity(entityID); + var entity = graph.hasEntity(entityID); + if (!entity) return; var issues = validateEntity(entity); issues.forEach(function(issue) { diff --git a/modules/validations/close_nodes.js b/modules/validations/close_nodes.js index 985ac2771..a52a08b65 100644 --- a/modules/validations/close_nodes.js +++ b/modules/validations/close_nodes.js @@ -3,7 +3,7 @@ import { utilDisplayLabel } from '../util'; import { t } from '../util/locale'; import { validationIssue, validationIssueFix } from '../core/validation'; import { osmRoutableHighwayTagValues } from '../osm/tags'; -import { geoExtent, geoSphericalDistance } from '../geo'; +import { geoSphericalDistance } from '../geo'; export function validationCloseNodes() { diff --git a/modules/validations/disconnected_way.js b/modules/validations/disconnected_way.js index 5c8ef5676..591bd7bd8 100644 --- a/modules/validations/disconnected_way.js +++ b/modules/validations/disconnected_way.js @@ -23,10 +23,11 @@ export function validationDisconnectedWay() { var entityLabel = utilDisplayLabel(entity, context); var fixes = []; var entityID = entity.id; - var firstID = entity.first(); - var lastID = entity.last(); if (entity.type === 'way' && !entity.isClosed()) { + var firstID = entity.first(); + var lastID = entity.last(); + var first = context.entity(firstID); if (first.tags.noexit !== 'yes') { fixes.push(new validationIssueFix({