Fixing null reference exception in the check for service call access