Export to Excel when filter left empty

Hello, I am using the export to Excel as described in the docs and demo and it works perfectly when a filter is selected on any column (or multiple columns). However, if no filter is selected the app crashes with a Parse error - ParseException: Expression expected and this is related to the query filter being empty.
Fclnr.ExportController.ApplyQuery(IQueryable items, IQueryCollection query) in ExportController.cs

    {
        if (query != null)
        {
            var filter = query.ContainsKey("$filter") ? query["$filter"].ToString() : null;
            if (!string.IsNullOrEmpty(filter))
            {
                items = items.Where(filter);
            }
            if (query.ContainsKey("$orderBy"))
            {
                items = items.OrderBy(query["$orderBy"].ToString());
            }

Is there a simple way to have the filter default to ALL or something like that?
Many thanks...

As can be seen from the code there are a few checks to make sure the filter is not empty. Use the Visual Studio debugger to inspect the actual value of the filter variable.

Hello Korchev, thanks for your reply. My point is that the filter is deliberately left empty, i.e. I might want to export the complete list, so haven't set any filters. I just wondered if I could have a default condition for this?

If the filter is empty the export controller will not apply filtering. Check the code.

Agreed and understood. But surely it should return all rows rather than just falling over?
I have checked the code and have also debugged in VS and all I can see is that an empty filter is not handled. It checks for Null query but not null filter. I guess that I can move the code to ‘ignored files’ and have a go at rewriting?

if (!string.IsNullOrEmpty(filter)) checks for null filter.

Thanks, don’t remember seeing that but will check again.

@Codmental see your first post