Prevent possible null-pointer exception when setting filter