Check that result is not undefined/null before trying to access its profile -- Related to 1739