This is all dependent on the clause or conditions you have signed. Most people sign their contract with a clause subject to a building and pest inspection or similar. I would strongly advise you to talk to your solicitor or conveyancer about what you should do in this regard as there are numerous options. Some vendors may not take offers with conditions and others may.
Most agents will insist on conditions like “Subject to a major structural fault or defect”. In my opinion this is not advantageous to you as a home with a rusted roof can cost $20,000 plus to replace but this may not be considered as a structural defect. You’re spending the money so you need to consider everything and not be out of pocket if defects exist and you’re stuck with the property.