Make eval_all exit when largest match is empty.

This commit is contained in:
Danila Fedorin 2017-03-18 21:23:32 -07:00
parent adcc97ef0b
commit f83f0a1bcc

View File

@ -199,7 +199,7 @@ liblex_result eval_all(char* string, int index, eval_config* config, ll* matches
if(new_match){ if(new_match){
result = eval_word(string, index, config, new_match); result = eval_word(string, index, config, new_match);
if(result == LIBLEX_SUCCESS){ if(result == LIBLEX_SUCCESS){
if(new_match->pattern < 0){ if(new_match->pattern < 0 || new_match->from - new_match->to == 0){
done = 1; done = 1;
free(new_match); free(new_match);
if(string[index]){ if(string[index]){