tree: Fix #583 again Only set doc->intSubset after successful copy to avoid dangling pointers in error case.