Basically, if it gets close to the withdrawal date and Johnson hasn't negotiated a better deal and got it through parliament (not going to happen) or organised another referendum (unlikely) then parliament will pass a vote of no confidence in the government triggering a general election, parliament will then petition the EU for an extension (which the EU has already confirmed it will grant for an election or a referendum).