From: MFraters Date: Tue, 24 Feb 2015 10:32:07 +0000 (+0100) Subject: empty string in split_string_list fix X-Git-Tag: v8.3.0-rc1~424^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c5260a9a736df772d3f5847d519e8431f08c532;p=dealii.git empty string in split_string_list fix When an empty string or a string with only spaces is given to this function, the split_string_list function will ask in line 222 for name[-1], which will result in unpredictable behaviour. I propose to prevent this by adding a condition that the length of the string may not be 0. --- diff --git a/source/base/utilities.cc b/source/base/utilities.cc index 8af548922d..6507542bb7 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -219,7 +219,7 @@ namespace Utilities (name[0] == ' ')) name.erase (0,1); - while (name[name.length()-1] == ' ') + while (name[name.length()-1] == ' ' && name.length() != 0) name.erase (name.length()-1, 1); split_list.push_back (name);