mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-02 01:08:14 +00:00
Merge pull request #249 from mapbox/decode-check-error
Fail gracefully if input to tippecanoe-decode isn't a vector tile
This commit is contained in:
commit
b5c5d9dad6
10
decode.cpp
10
decode.cpp
@ -11,6 +11,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <protozero/pbf_reader.hpp>
|
||||||
#include "mvt.hpp"
|
#include "mvt.hpp"
|
||||||
#include "projection.hpp"
|
#include "projection.hpp"
|
||||||
#include "geometry.hpp"
|
#include "geometry.hpp"
|
||||||
@ -49,8 +50,13 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) {
|
|||||||
int within = 0;
|
int within = 0;
|
||||||
mvt_tile tile;
|
mvt_tile tile;
|
||||||
|
|
||||||
if (!tile.decode(message)) {
|
try {
|
||||||
fprintf(stderr, "Couldn't parse tile %d/%u/%u\n", z, x, y);
|
if (!tile.decode(message)) {
|
||||||
|
fprintf(stderr, "Couldn't parse tile %d/%u/%u\n", z, x, y);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
} catch (protozero::unknown_pbf_wire_type_exception e) {
|
||||||
|
fprintf(stderr, "PBF decoding error in tile %d/%u/%u\n", z, x, y);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user