Skip to content

Commit

Permalink
Be careful not to put infinities in JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Dec 19, 2023
1 parent e3cdbee commit fdb353f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mbtiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <stdlib.h>
#include <string.h>
#include <sqlite3.h>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <set>
Expand Down Expand Up @@ -688,6 +690,9 @@ metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minla

m.strategies_json = stringify_strategies(strategies);

if (isinf(droprate)) {
droprate = LLONG_MAX;
}
if (basezoom != maxzoom || droprate != 2.5 || retain_points_multiplier != 1) {
m.decisions_json = std::string("{") +
"\"basezoom\":" + std::to_string(basezoom) + "," +
Expand Down

0 comments on commit fdb353f

Please sign in to comment.