The commonAncestor() method of the Virus class returned null if the MRCA was the ur-virus, since the final if statement would get triggered and break out of the loop before the ancestry set had a chance to get checked. This would trigger a null pointer exception during tree re-rooting if the root of the tree was the ur-virus.
The
commonAncestor()
method of theVirus
class returnednull
if the MRCA was the ur-virus, since the final if statement would get triggered and break out of the loop before the ancestry set had a chance to get checked. This would trigger a null pointer exception during tree re-rooting if the root of the tree was the ur-virus.