GTNPORTAL-3378 - Wrapped the cache control code into a null check

Tested by mposolda, as he was having this problem and confirmed that it fixed.