Fix potential crash if maybe_add_text() fails.