MN 60 Apaṇṇaka: The Incontrovertible Teaching
The Buddha sets out the opposing philosophical views of eternalism and nihilism. Those who hold that there is an afterlife and such a thing as karma are the ‘eternalists’. Nihilists hold that there are no such things.
The nihilists tend to engage in negative actions of body, speech and mind. If they are right then they are ‘safe enough’ after death, but are criticised by the wise here and now. If they are wrong then they have ‘made an unlucky thrown on both counts’, as they are still criticised here and now but also risk going to the hell realms.
The eternalists assume an afterlife and karma and so tend to wholesome actions, are praised by the wise and may go to the heavenly realms if they are right and it won’t matter if they are wrong, but they still get praised.
It is therefore sensible to assume an afterlife and karma are both true.