Replace:
PHP Code:
$userinfo[where] = "Viewing Profile of <a href='member.php?s=$session[sessionhash]&action=getinfo&userid=$userid[3]'>$username[username]</a>";
With:
PHP Code:
if (!$username[username]) {
$userinfo[where] = "$bbtitle <a href='index.php?s=$session[sessionhash]'>Main Index</a>";
} else {
$userinfo[where] = "Viewing Profile of <a href='member.php?s=$session[sessionhash]&action=getinfo&userid=$userid[3]'>$username[username]</a>";
}