Charmed() by itself is a null pointer and will create a zone crash. There is no current entity, that's why caster-> is specified. The server will basically say is what not charmed, and then crash.

But, caster->GetPet()->Charmed() is the correct code to find it the caster's pet has a charm spell on them. I've used it in the past, and it wouldn't compile if it wasn't valid.