But suppose they ran out of food. And suppose there was no shuttle from the ship due to owner going bankrupt. I think they could probably call a mayday signal and get rescued by some other vessel.
They can and will obtain supplies and food at no cost (essentially, with the ship and cargo as collateral) but they can't really abandon it.
Do note that calling mayday gives the rescuing vessel significant rights to the ship and cargo. If your ship is not at risk of sinking, that would be a really expensive way to solve a comparably minor problem, ordering a daily helicopter delivery from the closest McDonalds would be much cheaper.
What happens to the ship isn't really the crew's problem.
Eating? Paying rent? These are the crew's problem. You can't seriously expect them to prioritize the employer that isn't paying/feeding them over their own well-being.
It is their problem; they will get paid in full by staying on ship (no matter what happens to their employer) but will forfeit that pay by abandoning the ship, and for the officers, there is the abovementioned criminal liability if the abandoned ship causes any harm (e.g. by leaking chemicals from cargo).
They're sitting on a ship + cargo that is far more valuable than their outstanding pay, and legally they have a priority claim over all of that.
While the cargo is owned by others, and the ship may be sold during bankruptcy, but maritime law prescribes that none of them can get their stuff until the crew has been paid in full; so in essence they can (and will) hold these billions of dollars of goods as hostage. $16b / 66 Hanjin ships means that an average ship will have cargo $250 million worth, and if anyone wants to receive that cargo, they'll find a way to pay the outstanding wages, which is, rounding to whole millions, approximately 0.
They can also get food and 'maintenance fuel' (enough for running the internal systems, not the huge amount required for main engines) with the ship/cargo as effective collateral, even though they're not the owners - it's the owners legal responsibility to supply that, the crew is authorised to run up a bill and the owner (the new post-bankruptcy owner) will have to pay that or get the ship seized until they do.
The main trouble of these seamen is that it will take an unknown amount of time to get this settled, not that they'd not get paid for these months.
There's nothing a captain can do about a bankrupt company. There is definitely a lot a captain can do about a ship that they've been given exclusive control over. That's part of being a captain: your sole responsibility is to get the ship where it's supposed to go without running into things or sinking or injuring the crew.