add: if (flist->count == 0) { flist->high = -1; return; }
context: static void clean_flist(struct file_list *flist, int strip_root, int no_dups){	int i, prev_i = 0;	if (!flist || flist->count == 0)		return;	sorting_flist = flist;	qsort(flist->files, flist->count,	    sizeof flist->files[0], (int (*)())file_compare);	sorting_flist = NULL;	for (i = no_dups? 0 : flist->count; i < flist->count; i++) {		if (flist->files[i]->basename) {			prev_i = i;			break;		}	}	flist->low = prev_i;	while (++i < flist->count) {		int j;		struct file_struct *file = flist->files[i];		if (!file->basename)			continue;		if (f_name_cmp(file, flist->files[prev_i]) == 0)			j = prev_i;		else if (protocol_version >= 29 && S_ISDIR(file->mode)) {			int save_mode = file->mode;			/* Make sure that this directory doesn't duplicate a			 * non-directory earlier in the list. */			flist->high = prev_i;			file->mode = S_IFREG;			j = flist_find(flist, file);			file->mode = save_mode;		} else			j = -1;		if (j >= 0) {			struct file_struct *fp = flist->files[j];			int keep, drop;			/* If one is a dir and the other is not, we want to			 * keep the dir because it might have contents in the			 * list. */			if (S_ISDIR(file->mode) != S_ISDIR(fp->mode)) {				if (S_ISDIR(file->mode))					keep = i, drop = j;				else					keep = j, drop = i;			} else				keep = j, drop = i;			if (verbose > 1 && !am_server) {				rprintf(FINFO,					"removing duplicate name %s from file list (%d)\n",					safe_fname(f_name(file)), drop);			}			/* Make sure that if we unduplicate '.', that we don't			 * lose track of a user-specified top directory. */			flist->files[keep]->flags |= flist->files[drop]->flags						   & (FLAG_TOP_DIR|FLAG_DEL_HERE);			clear_file(drop, flist);			if (keep == i) {				if (flist->low == drop) {					for (j = drop + 1;					     j < i && !flist->files[j]->basename;					     j++) {}					flist->low = j;				}				prev_i = i;			}		} else			prev_i = i;	}	flist->high = no_dups ? prev_i : flist->count - 1;	if (strip_root) {		/* We need to strip off the leading slashes for relative		 * paths, but this must be done _after_ the sorting phase. */		for (i = flist->low; i <= flist->high; i++) {			struct file_struct *file = flist->files[i];			if (!file->dirname)				continue;			if (*file->dirname == '/') {				char *s = file->dirname + 1;				while (*s == '/') s++;				memmove(file->dirname, s, strlen(s) + 1);			}			if (!*file->dirname)				file->dirname = NULL;		}	}}