When there's no danger at all, but defenders would make sense for martial law reasons, notable danger might still get assigned to the value of the defender. The check "qdanger >= our_def" assumes that qdanger > 0, which it's not when we're in this code block solely for martial law. So in the special case that both qdanger and our_def are zero, danger is considered 100%.
military_advisor_choose_build()
When there's no danger at all, but defenders would make sense for martial law reasons, notable danger might still get assigned to the value of the defender. The check "qdanger >= our_def" assumes that qdanger > 0, which it's not when we're in this code block solely for martial law. So in the special case that both qdanger and our_def are zero, danger is considered 100%.