From 9a32ab6294d9ccf9121cc74278068c629617e95e Mon Sep 17 00:00:00 2001 From: mes5k Date: Tue, 17 Jun 2008 16:48:10 +0000 Subject: [PATCH] bug in while loop --- include/tclap/StdOutput.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/tclap/StdOutput.h b/include/tclap/StdOutput.h index 9dd6d0f..9ceac0c 100644 --- a/include/tclap/StdOutput.h +++ b/include/tclap/StdOutput.h @@ -248,10 +248,10 @@ inline void StdOutput::spacePrint( std::ostream& os, // trim the length so it doesn't end in middle of a word if ( stringLen == allowedLen ) - while ( s[stringLen+start] != ' ' && + while ( stringLen >= 0 && + s[stringLen+start] != ' ' && s[stringLen+start] != ',' && - s[stringLen+start] != '|' && - stringLen >= 0 ) + s[stringLen+start] != '|' ) stringLen--; // ok, the word is longer than the line, so just split