Fix some compiler warnings

fixes #7826
Make SetExpression check whether the LHS is null

fixes #7814