In fact, the opposite was true. Adversity moved David to cling to Jehovah and maintain the fine attitude he had when he ran away because of Saul.
(‏ ٢ صموئيل ٣ :‏ ​ ٢٢ -‏ ٣٠ ؛‏ ١٥ :‏ ​ ١ -‏ ١٧ ،‏ ٣١ ؛‏ ١٦ :‏ ​ ١٥ ،‏ ٢١‏ )‏ لٰكِنَّ دَاوُدَ لَمْ يَصِرْ مُتَشَكِّيًا وَلَمْ يَهْجُرِ ٱلْعِبَادَةَ ٱلْحَقَّةَ .‏