diff --git a/gnucash/import-export/import-backend.c b/gnucash/import-export/import-backend.c index ebc37c3a7b..888b913b2f 100644 --- a/gnucash/import-export/import-backend.c +++ b/gnucash/import-export/import-backend.c @@ -387,8 +387,24 @@ tokenize_string(GList* existing_tokens, const char *string) /* add each token to the token GList */ while (stringpos && *stringpos) { - /* prepend the char* to the token GList */ - existing_tokens = g_list_prepend(existing_tokens, g_strdup(*stringpos)); + if (strlen(*stringpos) > 0) + { + /* check for duplicated tokens */ + gboolean duplicated = FALSE; + for (GList* token = existing_tokens; token != NULL; token = token->next) + { + if (g_strcmp0(token->data, *stringpos) == 0) + { + duplicated = TRUE; + break; + } + } + if (duplicated == FALSE) + { + /* prepend the char* to the token GList */ + existing_tokens = g_list_prepend(existing_tokens, g_strdup(*stringpos)); + } + } /* then move to the next string */ stringpos++;