From a525b3bd096890c63fd66410b211791c6ec893c6 Mon Sep 17 00:00:00 2001 From: Davide Gessa Date: Mon, 6 Jun 2016 20:17:29 +0200 Subject: [PATCH] Remove assertion and handle error cases Fix #1633 --- Engine/lib/nativeFileDialogs/nfd_gtk.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Engine/lib/nativeFileDialogs/nfd_gtk.c b/Engine/lib/nativeFileDialogs/nfd_gtk.c index 2d7b9b5f6..32f6a8d44 100644 --- a/Engine/lib/nativeFileDialogs/nfd_gtk.c +++ b/Engine/lib/nativeFileDialogs/nfd_gtk.c @@ -47,10 +47,13 @@ static void AddFiltersToDialog( GtkWidget *dialog, const char *filterList ) if ( NFDi_IsFilterSegmentChar(*p_filterList) ) { char typebufWildcard[NFD_MAX_STRLEN]; - /* add another type to the filter */ - assert( strlen(typebuf) > 0 ); - assert( strlen(typebuf) < NFD_MAX_STRLEN-1 ); + /* add another type to the filter */ + if (strlen(typebuf) <= 0 || strlen(typebuf) > NFD_MAX_STRLEN-1) { + p_filterList++; + continue; + } + snprintf( typebufWildcard, NFD_MAX_STRLEN, "*.%s", typebuf ); AddTypeToFilterName( typebuf, filterName, NFD_MAX_STRLEN );