--- C:\Users\Ramesh\AppData\Local\Temp\patterns.module-revBASE.svn000.tmp.module	2010-07-01 17:50:44.000000000 +-0100
+++ Q:\nbc\kola_rnair\src\sites\all\modules\patterns\patterns.module	2010-07-01 17:53:31.000000000 +-0100
@@ -1210,24 +1210,26 @@
  * Recurse through the values of a parsed xml file to create a
  * multi-dimensional representation of the data.
  */
 function _patterns_parse_tag($data, &$index = 0) {
   $pattern = array();
 
-  while ($current = $data[$index]) {
+  while (isset($data[$index]) && ($current = $data[$index])) {
     $type = $current['type'];
 
-    foreach((array)$current['attributes'] as $key => $value) {
-      $current[strtolower($key)] = $value;
+    if (isset($current['attributes'])) {
+	    foreach((array)$current['attributes'] as $key => $value) {
+	      $current[strtolower($key)] = $value;
+	    }
     }
 
     $current['tag'] = strtolower($current['tag']);
 
     unset($current['type'], $current['level'], $current['attributes']);
 
-    if (!trim($current['value']) && $current['value'] != "0") {
+    if (isset($current['value']) && !trim($current['value']) && $current['value'] != "0") {
       unset($current['value']);
     }
 
     switch($type) {
       case 'open':
         $index++;
@@ -1237,13 +1239,13 @@
       case 'close':
         $index++;
         return $pattern;
         break;
       case 'complete':
         // In order to support more complex/non-standard features we can use serialized data
-        if ($current['attributes']['serialized']) {
+        if (isset($current['attributes']) && $current['attributes']['serialized']) {
           $value = unserialize($current['value']);
 
           if (isset($value)) {
             $current['value'] = $value;
           }
         }
@@ -1375,13 +1377,13 @@
 
     if (!$pattern) {
       return FALSE;
     }
   }
 
-  $pattern->subpatterns_run_mode = $params['run-subpatterns'];
+  $pattern->subpatterns_run_mode = isset($params['run-subpatterns']) ? $params['run-subpatterns'] : FALSE;
   $pattern_details = patterns_get_pattern_details($pattern, TRUE);
 
   $modules = $pattern_details['modules'];
   $actions = $pattern_details['actions'];
   $actions_map = array('patterns' => $pattern_details['info'], 'map' => $pattern_details['actions_map']);
   $info = reset($pattern_details['info']);
@@ -1474,12 +1476,14 @@
 
   // Prepare actions for validation/processing
   foreach($actions as $key => &$data) {
     patterns_invoke($actions[$key], 'prepare');
   }
 
+  $errors = array();
+  
   // Pre validate tags with their appropriate components
   foreach($actions as $key => &$data) {
 
     $action_location = patterns_locate_action($key, $actions_map);
     $index = $action_location['key'];
     $pattern_title = $action_location['title'];
@@ -1541,13 +1545,13 @@
 
 /**
  * Finish a batch operation
  */
 function patterns_batch_finish($success, $results, $operations) {
   $info = $_SESSION['patterns_batch_info'];
-  if (!($results['abort'])) {
+  if (!isset($results['abort']) || !($results['abort'])) {
     foreach ($info as $key => $i) {
       drupal_set_message(t('Pattern "@pattern" ran successfully.', array('@pattern' => $i['title'])));
       db_query('UPDATE {patterns} SET status = 1, enabled = "%s" WHERE pid = %d', time(), $key);
     }
   }
   else {
@@ -1970,12 +1974,16 @@
 
 function _patterns_rearrange_data($data, $parent = '') {
   $numeric = array();
   $count=0;
 
   foreach($data as $key => $value) {
+  	
+  	if (!isset($value['value']))
+  	 continue;
+  	
     if ($value['value'] == 'false') {
       $value['value'] = false;
     }
     else if ($value['value'] == 'true') {
       $value['value'] = true;
     }
