CampaignVisitorGroupFilter throws NullReferenceException if no http context exist

Fixed in

EPiServer.Commerce 9.19.0

Created

Jun 16, 2016

Updated

Nov 23, 2016

Area

Core

State

Closed, Fixed and tested


Description

CampaignVisitorGroupFilter.IsInVisitorGroup generates a NullReferenceException if it is fed with null for httpContext. And, that happens if _httpContextAccessor() returns null.

An http context is required for evaluating criteria. So we need to decide if the expected behavior is that we remove all or no promotion when filtering if there is no http context. But it should not throw an exception.

See world forum: http://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2016/5/functionality-to-evaluate-promotions-on-entries/