From cb45f1c3bd7c6b30bf362b8dd4305f3fe104db33 Mon Sep 17 00:00:00 2001
From: Eric Fischer <enf@pobox.com>
Date: Tue, 12 Jul 2016 15:56:57 -0700
Subject: [PATCH] That's still not right. Don't generate a tile with no layers.

---
 CHANGELOG.md                        | 5 +++++
 tests/empty-linestring/out/-ac.json | 3 ---
 tile.cpp                            | 2 +-
 version.hpp                         | 2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3703c41..dd90ba8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 1.12.5
+
+* Be careful not to produce an empty tile if there was a feature with
+  empty geometry.
+
 ## 1.12.4
 
 * Be even more careful not to produce features with empty geometry
diff --git a/tests/empty-linestring/out/-ac.json b/tests/empty-linestring/out/-ac.json
index 6e7e263..050d22e 100644
--- a/tests/empty-linestring/out/-ac.json
+++ b/tests/empty-linestring/out/-ac.json
@@ -64,9 +64,6 @@
 ] }
 ] }
 ,
-{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 328, "y": 791 }, "features": [
-] }
-,
 { "type": "FeatureCollection", "properties": { "zoom": 12, "x": 650, "y": 1578 }, "features": [
 { "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
 { "type": "Feature", "properties": {  }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822235, 38.090509 ], [ -122.822213, 38.090543 ] ] } }
diff --git a/tile.cpp b/tile.cpp
index 580a647..59435ad 100644
--- a/tile.cpp
+++ b/tile.cpp
@@ -1061,7 +1061,7 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
 			oprogress = progress;
 		}
 
-		if (totalsize > 0) {
+		if (totalsize > 0 && tile.layers.size() > 0) {
 			if (totalsize > 200000 && !prevent[P_FEATURE_LIMIT]) {
 				fprintf(stderr, "tile %d/%u/%u has %lld features, >200000    \n", z, tx, ty, totalsize);
 				fprintf(stderr, "Try using -B to set a higher base zoom level.\n");
diff --git a/version.hpp b/version.hpp
index efe6062..c32ca56 100644
--- a/version.hpp
+++ b/version.hpp
@@ -1 +1 @@
-#define VERSION "tippecanoe v1.12.4\n"
+#define VERSION "tippecanoe v1.12.5\n"