Move the call to `getProperty` inside of the `if (hasProperty)` body