This:
  dtStatusFailed(m_nav->isValidPolyRef(grandpaRef))
should be:
  !m_nav->isValidPolyRef(grandpaRef)
isValidPolyRef() returns boolean. The function also checks for null refs, so the whole if becomes:

if (invalidParent || !m_nav->isValidPolyRef(grandpaRef))