Cake PHP: undefined offset error
===

i am newbie with Cake PHP. I am trying to run application that I have downloaded recently but it doesn't work. 

My debug.log file says:
    2012-07-31 12:31:47 Debug: Notice (8): Undefined offset: 0 in  [C:\wamp\www\app\models\vwbrowse.php, line 78]

And my error.log file: 
    2012-07-31 12:31:47 Warning: Warning (2): array_keys() expects parameter 1 to be array, null given in [C:\wamp\www\app\models\vwbrowse.php, line 78]

And finally this is function that causes problem:

	function afterFind($results, $primary)
	{
		if(!$primary) return $results;

		$ret = array();
		
		//we are primary and not part of an associated find
		if(!is_array($results)) //find first
		{
			$tables = array_keys($results);
			$record = array();
			foreach($tables as $table){
				$record = array_merge($record,$result[$table]);
			}
			$ret['Vwbrowse'] = $record;
			
		}else{ //merge all arrays if separated
			$tables = array_keys($results[0]);
			foreach($results as $result){
				$record['Vwbrowse'] = array();
				foreach($tables as $table){
					$record['Vwbrowse'] = array_merge($record['Vwbrowse'],$result[$table]);
				}
				$ret[] = $record;
			}
		}

		return $ret;
	}

**This is line 78: $tables = array_keys($results[0]);
**

What is wrong? Thanks in advance for solution.