Don't try to look into the third char if the line is < 3 chars

This commit is contained in:
tastytea 2022-03-16 16:43:22 +01:00
parent 8949b857c4
commit e8b74d10d1
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 2 additions and 1 deletions

View File

@ -54,7 +54,8 @@ int main()
{
const auto line_nc{remove_colors(line)};
// Don't color +++ and --- lines
if (line.length() >= 2 && (line_nc[2] != '+' && line_nc[2] != '-'))
if (line.length() >= 2
&& (line.length() < 3 || (line_nc[2] != '+' && line_nc[2] != '-')))
{
if (line_nc[1] == '+')
{