David encouraged himself in the Lord 1 Sam 30:6

1 Samuel 30:6 (King James Version)

6And David was greatly distressed; for the people spake of stoning him, because the soul of all the people was grieved, every man for his sons and for his daughters: but David encouraged himself in the LORD his God.