Or you could just catch the exception that is thrown on attempting the assignment.

HTH

David.