Check REQUEST_CONTEXT.context exists before accessing it.

LMS-11226
Is it just because the template being rendered is only available in the LMS?