Skip to content

Commit

Permalink
Merge pull request #923 from fujimo-t/fix_25334
Browse files Browse the repository at this point in the history
fix bug #25334, segmentation faults in CJK help page
  • Loading branch information
Wedge009 committed Feb 3, 2017
2 parents f5f7821 + 61e2f27 commit 6e1c7be
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/help/help_text_area.cpp
Expand Up @@ -337,9 +337,17 @@ void help_text_area::add_text_item(const std::string& text, const std::string& r
else
color = font::YELLOW_COLOR;

surface surf(font::get_rendered_text(first_part, scaled_font_size, color, state));
if (!surf.null())
add_item(item(surf, curr_loc_.first, curr_loc_.second, first_part, ref_dst));
// In split_in_width(), no_break_after() and no_break_before() are used(see marked-up_text.cpp).
// Thus, even if there is enough remaining_width for the next word,
// sometimes empty string is returned from split_in_width().
if (first_part.empty()) {
down_one_line();
}
else {
surface surf(font::get_rendered_text(first_part, scaled_font_size, color, state));
if (!surf.null())
add_item(item(surf, curr_loc_.first, curr_loc_.second, first_part, ref_dst));
}
if (parts.size() > 1) {

std::string& s = parts.back();
Expand Down

0 comments on commit 6e1c7be

Please sign in to comment.