From 4d6ebaa08814b61423918b210d6cd69c3f0ff915 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 29 Aug 2017 16:04:50 -0700 Subject: [PATCH] Fix nulls and negative integers in geobuf parsing --- geobuf.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/geobuf.cpp b/geobuf.cpp index 1b3f00e7..2fab3d8c 100644 --- a/geobuf.cpp +++ b/geobuf.cpp @@ -41,7 +41,7 @@ serial_val readValue(protozero::pbf_reader &pbf, std::vector &keys) case 4: sv.type = mvt_double; - sv.s = std::to_string(-pbf.get_uint64()); + sv.s = std::to_string(- (long long) pbf.get_uint64()); break; case 5: @@ -56,6 +56,11 @@ serial_val readValue(protozero::pbf_reader &pbf, std::vector &keys) case 6: sv.type = mvt_string; // stringified JSON sv.s = pbf.get_string(); + + if (sv.s == "null") { + sv.type = mvt_null; + } + break; default: