Check for nil before calling on value

Small validation fix, prevents calls to methods on nil