set now expands the variable size, if index is outside it

This commit is contained in:
maxfl 2012-06-19 15:51:43 +04:00
parent 9b0ffa8315
commit 22a4cd686f

View file

@ -260,10 +260,14 @@ static int update_values( wcstring_list_t &list,
*/ */
long ind = indexes[i] - 1; long ind = indexes[i] - 1;
const wcstring newv = values[ i ]; const wcstring newv = values[ i ];
if( ind < 0 || ind>=list.size() ) if( ind < 0 )
{ {
return 1; return 1;
} }
if ( ind >= list.size() )
{
list.resize( ind+1 );
}
// free((void *) al_get(list, ind)); // free((void *) al_get(list, ind));
list[ ind ] = newv; list[ ind ] = newv;