Check REQUEST_CONTEXT.context exists before accessing it.

LMS-11226

See #4820 for discussion