Skip to content

Commit 5b25afe

Browse files
committed
Allow NULL values in new middle format members list
This makes osm2pgsql a bit more future proof by allowing the list of members (which is encoded as JSON in the new middle format) to be empty, i.e. to contain NULL. We currently don't write empty member lists as NULL but as an empty JSON list, but if we change this in the future, older versions of osm2pgsql will be able to read this correctly.
1 parent 5c4dcc1 commit 5b25afe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/middle-pgsql.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,10 @@ template <typename T>
443443
void pgsql_parse_json_members(char const *string,
444444
osmium::memory::Buffer *buffer, T *obuilder)
445445
{
446+
if (*string == '\0') { // NULL
447+
return;
448+
}
449+
446450
osmium::builder::RelationMemberListBuilder builder{*buffer, obuilder};
447451
member_list_json_builder parser{&builder};
448452
nlohmann::json::sax_parse(string, &parser);

0 commit comments

Comments
 (0)