Added better null checks in setVector2D.