Once, Prince Bodhi built a magnificent palace for himself. When the palace was finished he invited the Buddha for
alms-food. For this special occasion, he had the building decorated and perfumed with four kinds of scents and incense. Also, a long length of cloth was spread on the floor, starting from the threshold to the interior of the room. Then, because he had no children, the prince made a solemn asseveration that if he were to have any children the Buddha should step on the cloth.
When the Buddha came, Prince Bodhi respectfully requested the Buddha three times to enter the room. But the Buddha, instead of moving, only looked at Ananda( Buddha’ chief disciple). Ananda understood him and so asked Prince Bodhi to remove the cloth from the door-step. Then only, the Buddha entered the palace. The prince then offered delicious and choice food to the Buddha. After the meal, the prince asked the Buddha why he did not step on the cloth. The Buddha in turn asked the prince whether he had not spread the cloth making a solemn asseveration that if he were to be blessed with a child, the Buddha would step on it; and the prince replied in the affirmative.
To him, the Buddha said that he and his wife were not going to have any children because of their past evil deeds. The Buddha then related their past story. In one of their past existences, the prince and his wife were the sole survivors of a shipwreck. They were stranded on a deserted island, and there they lived by eating birds’ eggs, fledglings and birds, without any feeling of remorse at any time. For that evil deed, they would not be blessed with any children. If they had felt even a slight remorse for their deed at any stage of their lives, they could have a child or two in this existence. Then turning to the prince, the Buddha said, “One who loves himself should guard himself in all stages of life, or at least, during one stage in his life.”
Source: Dhammapada (Verse 157)