diff --git a/filetype.cc b/filetype.cc index 9eaad6f6..40f36285 100644 --- a/filetype.cc +++ b/filetype.cc @@ -27,6 +27,9 @@ string simplifyString( string const & str ) while( endPos && Utf8::isspace( str[ endPos - 1 ] ) ) --endPos; + if( endPos <= beginPos ) + return string(); + result.reserve( endPos - beginPos ); while( beginPos < endPos )