Skip to content

Commit

Permalink
Handle case where author of a comment isn't a public user. This shoul…
Browse files Browse the repository at this point in the history
…dn't happen on the real dumps, as public users can no longer make changes.
  • Loading branch information
zerebubuth committed Jun 8, 2016
1 parent ebd5cb6 commit 4182966
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/xml_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,14 @@ void xml_writer::changesets(const std::vector<changeset> &css,
if ((comment_itr->changeset_id == cs.id) &&
(comment_itr->visible)) {
user_map_t::const_iterator author_itr = m_users.find(comment_itr->author_id);
m_impl->add_comment(*comment_itr, author_itr->second);
if (author_itr == m_users.end()) {
// a user with data_public managed to make a comment?
std::cerr << "User " << comment_itr->author_id << " with "
<< "data_public=false made a comment on changeset "
<< comment_itr->changeset_id << "? Ignoring.\n";
} else {
m_impl->add_comment(*comment_itr, author_itr->second);
}
}
}

Expand Down
Binary file modified test/bad-character.dmp
Binary file not shown.
Binary file modified test/changesets-badchar.xml.case/changesets.osm.bz2
Binary file not shown.
Binary file modified test/discussions-badchar.xml.case/discussions.osm.bz2
Binary file not shown.

0 comments on commit 4182966

Please sign in to comment.