Insurance companies anticipate this kind of moral hazard, and typically include an exception for death by suicide. However, the exception lasts only a few years, and varies by country. Economists compared suicide rates in countries with shorter exceptions and found statistically significant evidence of moral hazard:
...the shorter the exemption period, the greater the demand for life insurance. And the greater the demand for life insurance, the higher the suicide rate.