Merge pull request #13 from Birch-san/out-of-bounds

Guard against out-of-bounds
This commit is contained in:
Birch-san 2019-08-12 14:59:38 +01:00 committed by GitHub
commit 6c8d39f1e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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