Dangling Modifiers
A dangling modifier is a word or a phrase that modifies a word that is not clearly stated in a sentence.
For example:
While waiting for the doctor to examine her, she was bored.
The sentence has no error. You have to check that the subject after the comma is the doer of the verb.
She was bored while waiting for the doctor.
Having finished the homework, the lights were on.
The sentence is incorrect because "lights" can't finish homework!