diff -ur highlight-2.4.4.old/highlight/codegenerator.cpp highlight-2.4.4/highlight/codegenerator.cpp --- highlight-2.4.4.old/highlight/codegenerator.cpp 2006-02-19 09:11:18.000000000 -0800 +++ highlight-2.4.4/highlight/codegenerator.cpp 2006-02-19 09:11:18.000000000 -0800 @@ -284,7 +284,11 @@ bool CodeGenerator::readNewLine(string &newLine){ bool eof; - terminatingChar=newLine[lineIndex-1]; + if (lineIndex > 0) { + terminatingChar=newLine[lineIndex-1]; + } else { + terminatingChar = '\0'; + } if (formattingPossible && formattingEnabled) { eof=!formatter->hasMoreLines(); if (!eof) {