treedata could have a non-initialized tree in case of edge_snapping, leading to segfault. Spotted by @mano-wii, thanks.