From 7dce227b271e9e8d0028db697a70101615d6a5e6 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 29 Jul 2012 15:51:18 +1000 Subject: Extra checks to stop Clang analyze warnings. --- lexers/LexOthers.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lexers') diff --git a/lexers/LexOthers.cxx b/lexers/LexOthers.cxx index 259059fd9..ee5521bac 100644 --- a/lexers/LexOthers.cxx +++ b/lexers/LexOthers.cxx @@ -857,17 +857,19 @@ static void ColouriseMakeLine( while ((i < lengthLine) && isspacechar(lineBuffer[i])) { i++; } - if (lineBuffer[i] == '#') { // Comment - styler.ColourTo(endPos, SCE_MAKE_COMMENT); - return; - } - if (lineBuffer[i] == '!') { // Special directive - styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR); - return; + if (i < lengthLine) { + if (lineBuffer[i] == '#') { // Comment + styler.ColourTo(endPos, SCE_MAKE_COMMENT); + return; + } + if (lineBuffer[i] == '!') { // Special directive + styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR); + return; + } } int varCount = 0; while (i < lengthLine) { - if (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(') { + if (((i + 1) < lengthLine) && (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(')) { styler.ColourTo(startLine + i - 1, state); state = SCE_MAKE_IDENTIFIER; varCount++; -- cgit v1.2.3