guard against out-of-bounds when looking up what text to write into each row of preset table (which for some reason didn't cause any problems on macOS)

This commit is contained in:
Birch-san 2019-08-12 14:58:20 +01:00
parent aabb0b1aad
commit a4374594d4
No known key found for this signature in database
GPG Key ID: 726D53FF6A26AB9D

View File

@ -175,9 +175,11 @@ void TableComponent::paintCell (
g.setColour (getLookAndFeel().findColour (ListBox::textColourId)); g.setColour (getLookAndFeel().findColour (ListBox::textColourId));
g.setFont (font); g.setFont (font);
if (rowNumber < rows.size()) {
TableRow& row{ rows[rowNumber] }; TableRow& row{ rows[rowNumber] };
String text{ row.getStringContents(columnId) }; String text{ row.getStringContents(columnId) };
g.drawText(text, 2, 0, width - 4, height, Justification::centredLeft, true); g.drawText(text, 2, 0, width - 4, height, Justification::centredLeft, true);
}
g.setColour (getLookAndFeel().findColour (ListBox::backgroundColourId)); g.setColour (getLookAndFeel().findColour (ListBox::backgroundColourId));
g.fillRect (width - 1, 0, 1, height); g.fillRect (width - 1, 0, 1, height);