Skip to content

Commit

Permalink
Merge pull request #1 from mmc1718/catch-exception
Browse files Browse the repository at this point in the history
catch exception when parsing invalid pbf - fixes mapbox#817
  • Loading branch information
mmc1718 authored Sep 23, 2021
2 parents 18e53cd + c6b4371 commit 14408cf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tile-join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 14408cf

Please sign in to comment.