meaning that
It is more likely to do a bad think and get into troubles, when you have nothing to do.
With nothing to occupy them during the holidays, the bored teenagers began playing unpleasant pranks on their neighbors. An idle brain is the devil’s workshop.