Fixing potential NullPointerException when no span context is present