In The Name of Allaah, The Most Merciful, The Bestower of Mercy

If we saw a student of knowledge sitting in a gathering of jest, chitchatting and evil, then the [fact that] he has committed a misdeed against himself becomes a manifest and serious [affair]. And this [deed is also] an offence against knowledge and the people of knowledge, because [some other] people are likely to say: “These are students of knowledge and this is the end result of knowledge.” Therefore, he [i.e. the student who sits in a gathering of evil] has [in this case] committed a misdeed against himself and others.
Source: Excerpt from Sharh Hilyati Taalibil Ilm’ page 68. slightly paraphrased