Fix a problem in lib.php

In assessment_get_user_grades(), $assessment->teacher can be empty. Add
a if-condition to prevent SQL error.