Only initialize predicate if pattern is non-nil