fix the issue that tree.find will enter an infinite loop if the given key is null.