check chain length is nonzero before examining last entry
it was possible to reach add_link() without visiting an intermediate node first, and the check for a duplicate entry could then cause a crash.
Closes #4362 (closed)
it was possible to reach add_link() without visiting an intermediate node first, and the check for a duplicate entry could then cause a crash.
Closes #4362 (closed)