Prevent NullReferenceException

The variable val was not referenced later in the function and caused a
NullReferenceException.

http://issues.umbraco.org/issue/U4-4091