Having participated in threads discussing this for the 20 years I have been on ScubaBoard, the short answer is that you are generally pretty safe. I am unaware of any case in which this has happened, and, as I said, I have read 20 years of these threads. A professional diver who just happens to be on the boat has no legal obligation to effect a rescue of a random person on a boat. They would have to show that you in some way helped cause the accident, and that would be true of others as well.
Now for the exceptions.
If you indicate in any way that another diver can depend upon you for your support, that may suggest that you are working as a DM, even if you are not paid. If that person depended upon you in a professional capacity, then you might be considered to have a responsibility.
If you are a professional on the island of Malta, you can evidently be charged for murder if someone dies during a dive, even if you were in a restaurant on the other side of the island when it occurred. So far such cases have eventually been thrown out of court, but you never know, you might be the first person where the charges stick.