Fix potential crash during target attribute validation.