GCHandle value belongs to a different domain- Error in Unity playmode - music continues to play

After getting the UserData you will want to only proceed if it is not zero.

if (timelineInfoPtr != IntPtr.Zero)
{
    GCHandle timelineHandle = GCHandle.FromIntPtr(timelineInfoPtr);
    ...