There are treaties and conventions that ensure that you have consular aid from your country, but if you went on your own, there is not much your country can do legally except complain... and that may work, if we do not want to annoy the foreign country's people/government.