Oh no! .... I hate reading about such sudden and unexpected pet deaths, they are very hard to cope with, I really feel for you having lost my lovely girl Rex only a tad over 2 weeks ago very suddenly and inexpectedly despite her being in apparent perfect health and in great condition.
I expect you are shattered emotionally and I can't blame you as they do have a knack of getting firmly entrenched in our hearts as they are such sweet and gentle and smart little characters.
Did he die while
black bearding .... if no bb he likely died without pain or suffering , I can't see any indication of bbing in the photo, and looks like he's been gone for a while (rigor mortis) so at least you have an indication he simply dosed off and died. I hope that is the case.
Could any number of things, you say he was in bad shape when you adopted him, chances are he had an infection of some kind or perhaps something wrong internally. Only way to know is to have necropsy done by a vet pretty quick (and even then there is no guarantee the vet will find the cause).
If you decide to get another lizard to go into his tank (once you are ready) , I highly recommend you use F10 to sterilize his tank and all his tank furniture thoroughly incase what ever took him is long lasting in surfaces and infectious.
http://www.meadowsah.com/home/f10-environmental-products.html
this stuff is great , every vet here (Australia) swares by it, and most the reptile keepers I've met use it, you buy F10 as the concentrate (F10SC in a 200ml bottle) and it will last you for ages even if using every day to spot clean , as you use only 1 part in 200 or so of water in the spray bottle to sterilize surfaces.
Simply spray the contaminated surface and let stand for 30 minutes to air dry, and wrap away residue (if there is any) with piece of clean paper toweling, no more bacteria, no more viruses, no more fungal spores.