From: Torsten Dreyer Date: Tue, 5 Oct 2010 20:39:41 +0000 (+0200) Subject: Don't crash in strutils::trim() with empty strings X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0994ffc19518899ab2b7759b1c9726be0dbd1418;p=simgear.git Don't crash in strutils::trim() with empty strings --- diff --git a/simgear/misc/strutils.cxx b/simgear/misc/strutils.cxx index be05d692..cc56aa41 100644 --- a/simgear/misc/strutils.cxx +++ b/simgear/misc/strutils.cxx @@ -131,10 +131,9 @@ namespace simgear { static string do_strip( const string& s, int striptype ) { - // if (s.empty()) - // return s; - string::size_type len = s.length(); + if( len == 0 ) // empty string is trivial + return s; string::size_type i = 0; if (striptype != RIGHTSTRIP) {