PHP注意:未定义的偏移量:4

I'm getting the following error

PHP Notice: Undefined offset: 4 -- LINE 190

in the chunk of code below. I've tried a couple different solutions that I found here including isset, but nothing seems to work.

Does anyone have any suggestions?

// If we don't have any data get it from the db

$GLOBALS['AKB_CLASS_HELPER']->getCatsInfo();
$parentid = 0;

if (!empty($arrCats[0])) {
            foreach ($arrCats as $cat) {
                foreach ($GLOBALS['AKB_CLASS_HELPER']->tree->nodesByPid[$parentid] as $catid) {  <--------- LINE190
                    $pcat = $GLOBALS['AKB_CLASS_HELPER']->catsById[$catid];
                    if (strtolower($pcat['name']) == strtolower($cat)) {
                        $GLOBALS['CatTrails'][] = array ($pcat['categoryid'], $cat);
                        $this->_catId = $pcat['categoryid'];
                        $parentid = $pcat['categoryid'];
                        break;
                    }
                }
            }
        }