Isn't it a greater risk to buy bonds when the government is in debt?
That depends on the nation, which is issuing the bonds. Some of the countries issue bonds which are having a very low risk of default, such as the United States. But these bonds usually have very low interest payments, like 3% per year. On the other hand, there are bonds issued by "risky" nations, which are having higher interest rates.
Default risk is 100%, it's just a matter of time.