check null because Nullable object must have a value

fixes #3642