Prevent Nullpointerexceptions

On rare cases, fragments can deattach and cause this value to be null,
while the service still runs though.

Change-Id: I912d0e5154a4f702ca7d90b317a26fac7c1aabe6