From a4374594d43934c539b33cbfcf627b10ff1d26a5 Mon Sep 17 00:00:00 2001 From: Birch-san Date: Mon, 12 Aug 2019 14:58:20 +0100 Subject: [PATCH] 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) --- Source/TableComponent.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/TableComponent.cpp b/Source/TableComponent.cpp index dbb6a81..a3533b3 100644 --- a/Source/TableComponent.cpp +++ b/Source/TableComponent.cpp @@ -175,9 +175,11 @@ void TableComponent::paintCell ( g.setColour (getLookAndFeel().findColour (ListBox::textColourId)); g.setFont (font); - TableRow& row{rows[rowNumber]}; - String text{row.getStringContents(columnId)}; - g.drawText (text, 2, 0, width - 4, height, Justification::centredLeft, true); + 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);