return NULL when a tree is NULL
Merge pull request #1 from KiiCorp/fix-null-assertion

return NULL when a tree is NULL