Grid view not working on products page

The grid view has stopped working on the products page. The Grid / List icon still works fine, but the display is always in list view. The logic that determines the display type is now wrapped in a check for both 'show_search' and 'show_advanced_search', and in my case neither of these has been set. Reverting this code fixed the problem for me.