diff --git a/src/dialog/SDL_dialog_utils.c b/src/dialog/SDL_dialog_utils.c index 38be4a1174f38..9d7acbe5da251 100644 --- a/src/dialog/SDL_dialog_utils.c +++ b/src/dialog/SDL_dialog_utils.c @@ -59,7 +59,7 @@ char *convert_filters(const SDL_DialogFileFilter *filters, int nfilters, return NULL; } - terminator = f[1].name ? separator : suffix; + terminator = ((i + 1) < nfilters) ? separator : suffix; new_length = SDL_strlen(combined) + SDL_strlen(converted) + SDL_strlen(terminator) + 1;