As others stated, it's likely failing because the requested key doesn't exist in the array. I have a helper function here that takes the array, the suspected key, as well as a default return in the event the key does not exist.
protected function _getArrayValue($array, $key, $default = null)
{
if (isset($array[$key])) return $array[$key];
return $default;
}
hope it helps.