Skip to content

Commit

Permalink
text: fix is_whitespace() assertion when invalid chars are included
Browse files Browse the repository at this point in the history
  • Loading branch information
rdb committed Feb 17, 2018
1 parent 95eee0c commit 5c90f64
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 4 additions & 3 deletions panda/src/text/textAssembler.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1626,10 +1626,11 @@ assemble_row(TextAssembler::TextRow &row,
}

if (first_glyph != (TextGlyph *)NULL) {
assert(!first_glyph->is_whitespace());
advance = first_glyph->get_advance() * advance_scale;
swap(placement._glyph, first_glyph);
placed_glyphs.push_back(placement);
if (!first_glyph->is_whitespace()) {
swap(placement._glyph, first_glyph);
placed_glyphs.push_back(placement);
}
}

// Check if there is a second glyph to create a hacky ligature or some
Expand Down
7 changes: 7 additions & 0 deletions tests/text/test_text_assemble.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from panda3d import core

def test_text_assemble_null():
# Tests that no is_whitespace() assert occurs
assembler = core.TextAssembler(core.TextEncoder())
assembler.set_wtext(u"\0test")
assembler.assemble_text()

0 comments on commit 5c90f64

Please sign in to comment.