Hitting Jassert in juce_TextEditor.cpp

With the juce develop versions from the past week, I am hitting the following jassert in juce-TextEditor.cpp

std::pair<Point<float>, float> TextEditor::getTextSelectionEdge (int index, Edge edge) const
{
    jassert (0 <= index && index < getTotalNumChars());

...
}

If I revert back about a week, the problem goes away.

I create a TextEditor on the stack.

TextEditor partsEditor;

In my class constructor I setup the editor.

    partsEditor.setMultiLine(true);
    partsEditor.setReturnKeyStartsNewLine(true);
    partsEditor.setScrollbarsShown(true);
    partsEditor.onTextChange = [this] { saveParts(); };
    addAndMakeVisible(partsEditor);

And its main usage is below;

    void loadParts()
    {
        auto markers{ editState.getOrCreateChildWithName("MARKERS", &undoManager) };

        for (auto index = 0; index < markers.getNumChildren(); index++)
        {
            auto pattern = markers.getChildWithName("PATTERN" + juce::String(index));

            partsEditor.insertTextAtCaret
            (
                (pattern.getProperty("section").toString() + ", ") +
                (pattern.getProperty("begin").toString() + ", ") +
                (pattern.getProperty("end").toString() + "\n")
            );
        }
    }

Other than the setBounds() in my resized method, that’s about it.

Do I need to be doing things differently?

I’m also getting lots of asserts. Simply type some text and then press backspace.

void TextEditor::CaretState::updateEdge()
{
    jassert (0 <= position && position <= owner.getTotalNumChars());

    if (position == 0)
    {
        edge = Edge::leading;
    }

This appears to be fixed with today’s develop.

Thank you!