check for ->links before accessing as hashref