What was the discussion on the boat BEFORE the dive? It appears that you were diving as a gaggle, and not in buddy teams -- was there any discussion of what would happen when the first person ran low on gas? Some operators share gas, the way you did the first time; others send buddy teams to the surface, and yet others expect you to go up when your gas is low. Although I have my own opinions of which strategy is best, what really matters is that there should have been a plan in place, and everyone should have understood it.
On the other hand, you are the diver doing the dive. When you reached 50 bar, you had to make a decision. Your decision in both cases seems to have been to cede responsibility for deciding to the DM. At 50 bar, you either need more gas or you need to end the dive; in the first situation, you were given more gas (which, unless that was discussed ahead of time, you should not have expected to get). In the second, once the DM did not offer gas, you should have ended your dive at that point. Being caught underwater with inadequate breathing gas supplies is entirely your responsibility.
The bottom line is: Before the dive, decide who is diving with whom, and how a low-on-air diver is going to be managed. Be prepared to end a dive alone if you have to, and never put yourself in a position where you are at risk from being too low on gas to be safe underwater. Do not expect professional dive staff to perform basic responsibilities of diving for you.
On the other hand, you are the diver doing the dive. When you reached 50 bar, you had to make a decision. Your decision in both cases seems to have been to cede responsibility for deciding to the DM. At 50 bar, you either need more gas or you need to end the dive; in the first situation, you were given more gas (which, unless that was discussed ahead of time, you should not have expected to get). In the second, once the DM did not offer gas, you should have ended your dive at that point. Being caught underwater with inadequate breathing gas supplies is entirely your responsibility.
The bottom line is: Before the dive, decide who is diving with whom, and how a low-on-air diver is going to be managed. Be prepared to end a dive alone if you have to, and never put yourself in a position where you are at risk from being too low on gas to be safe underwater. Do not expect professional dive staff to perform basic responsibilities of diving for you.