fix segfault in wesnothd

broken in commit 'preserve traslatable strings in simple_wml.'
This commit is contained in:
gfgtdf 2018-08-07 23:40:12 +02:00 committed by GitHub
parent c6c5f1052b
commit 4f3ce6865c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -359,10 +359,11 @@ node::node(document& doc, node* parent, const char** str, int depth, string_span
// Read textdomain marker.
if (*endline == '#') {
const char* endline2 = strchr(endline + 1, '\n');
if (!endline2) {
throw error("did not find newline after '#'");
}
maybe_change_textdomain(endline, endline2, textdomain);
endline = endline2;
if (!endline)
throw error("did not find newline after '#'");
++endline;
}
@ -771,6 +772,7 @@ void node::shift_buffers(ptrdiff_t offset)
for(std::vector<attribute>::iterator i = attr_.begin(); i != attr_.end(); ++i) {
i->key = string_span(i->key.begin() + offset, i->key.size());
i->value = string_span(i->value.begin() + offset, i->value.size());
i->textdomain = string_span(i->textdomain.begin() + offset, i->textdomain.size());
}
for(child_map::iterator i = children_.begin(); i != children_.end(); ++i) {