That’s not true. Customary international law also applies to states, that are not themselves members of a treaty. In the case of international maritime war and international humanitarian laws this is widely accepted as such.