From 326ad34b82e744b98d3341f3b70d64406f73ebc9 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Thu, 31 Jan 2019 13:35:54 +0000
Subject: [PATCH] Verify longitude and latitude are present before adding feature

---
 map.js   |    2 +-
 map.html |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/map.html b/map.html
index 5bfd891..911a2c0 100644
--- a/map.html
+++ b/map.html
@@ -18,6 +18,6 @@
 <script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v5.3.0/build/ol.js" integrity="sha384-iQkGyyH4ioz3m+maM3s9MX1Oq67mACa4B9Z3ovUv3Sv37LJ96fx3WnZfLoiC3Wfl" crossorigin="anonymous"></script>
 <script tyle="text/javascript" src="lang_pl.js?v2" id="lang_script"></script>
 <script tyle="text/javascript" src="common.js?v2"></script>
-<script tyle="text/javascript" src="map.js?v4"></script>
+<script tyle="text/javascript" src="map.js?v5"></script>
 </body>
 </html>
diff --git a/map.js b/map.js
index 737a1f8..d3ceed8 100644
--- a/map.js
+++ b/map.js
@@ -242,7 +242,7 @@
 			var vehicle = data.vehicles[i];
 			
 			var vehicle_feature = buses_source.getFeatureById('b' + vehicle.id);
-			if(vehicle.isDeleted) {
+			if(vehicle.isDeleted || !vehicle.latitude || !vehicle.longitude) {
 				if(vehicle_feature) {
 					buses_source.removeFeature(vehicle_feature);
 					if(feature_clicked && feature_clicked.getId() === vehicle_feature.getId()) {

--
Gitblit v1.9.1