Fix possible null value returned from GetContext

when stopping listener.

@amoiseev-softheme, that's a bit another way to fix the same problem of D-24329, but with our crutch of deadlocks.