JUCE 5.4.1 AttributedString color crash


I upgraded to JUCE 5.4.1 yesterday and I am now having problems with drawing attributed strings. What I’m trying to do is drawing single letters in different colors. If you paste this snippet into the Projucer GUI application template, it crashes.

void MainComponent::paint (Graphics& g)
    // (Our component is opaque, so we must completely fill the background with a solid colour)
    g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));

    g.setFont (Font (16.0f));
    g.setColour (Colours::white);

    String text = "0001A";
    AttributedString textAttrString(text);

    int index = text.indexOf("1");
    if (index != -1)
        textAttrString.setColour(Range<int>(index, index+1), Colours::blue);

    textAttrString.draw(g, Rectangle<float>(60.0f, 6.0f, 275.0f, 24.0f));

Mistake in AttributedString? (ArrayBase::checkSourceIsNotMember() assertion)

I’ll push a fix for this, thanks for reporting.