Accepting God on your deathbed

So if someone was on their deathbed and they lived a horrid life but in their last moments they asked God for forgiveness because they felt guilty for all their actions. Do you think that they have a chance to come to god at that moment and receive salvation.