From e8b74d10d10b6f573397179677bccaab4ddf9fe7 Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 16 Mar 2022 16:43:22 +0100 Subject: [PATCH] Don't try to look into the third char if the line is < 3 chars --- src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index f4370cb..b6bafa5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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] == '+') {