||Yes, this could be potentially dangerous. Molds are fungi, and some species of mold can produce highly toxic chemicals. Even if you remove all the mold that you can see, the chemicals they produce could be spread throughout the Cannabis. There's no practical way to identify whether the particular mold growing on your Cannabis is toxic or not, but burning and inhaling the smoke of potentially toxic mold isn't worth the risk.|
The only thing you can do is throw the Cannabis away. If it was growing mold, chances are it would not have been very good smoking material anyway. Making sure that Cannabis is thoroughly dry before storing it should help prevent against mold.
Probably the primary acute danger with smoking cannabis that has molded is allergic reaction. Many molds produce chemicals and contain cells that can cause severe allergic reactions. The second danger is that a toxin produced by the mold would have a lingering damaging effect that would not be immediately identifiable. Your health is worth more than it would cost to buy more.