Crash when printing inside function

It’s a null pointer somewhere. Check that msg is valid, that msg->GetClass() is valid, etc. Also make sure the UObject you are using to call this message is valid.