catch exception when parsing invalid pbf - fixes #817

This commit is contained in:
marym 2021-09-20 20:17:49 +00:00
parent 18e53cd7fb
commit c6b43719c6

View File

@ -75,8 +75,13 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
int features_added = 0;
bool was_compressed;
if (!tile.decode(message, was_compressed)) {
fprintf(stderr, "Couldn't decompress tile %d/%u/%u\n", z, x, y);
try {
if (!tile.decode(message, was_compressed)) {
fprintf(stderr, "Couldn't decompress tile %d/%u/%u\n", z, x, y);
exit(EXIT_FAILURE);
}
} catch (std::exception const &e) {
fprintf(stderr, "PBF decoding error in tile %d/%u/%u\n", z, x, y);
exit(EXIT_FAILURE);
}