If a swift code is incorrect what happens?

If a SWIFT code is incorrect, the money transfer should not go through. Besides providing the SWIFT code, the sender also has to give the account number in the bank where the money is going to be sent. The wrong SWIFT code should void the transaction because the bank and the account number will not be matched.