Project

General

Profile

« Previous | Next » 

Revision 06d7ad52

Added by Patrick Plitzner over 4 years ago

ref #8595 Fix potential null pointer

View differences:

modules/cdm_dataportal/includes/descriptions.inc
2106 2106
  $descriptionString = '';
2107 2107
  if (!empty($root_nodes)) {
2108 2108
    foreach ($root_nodes as $root_node) {
2109
      foreach ($root_node->descriptionElements as $element) {
2110
        switch ($element->class) {
2111
          case 'CategoricalData':
2112
            $state_data = compose_state_data($element);
2113
            $state_data = implode(', ', $state_data);
2114
            if (!empty($state_data)) {
2115
              $descriptionString .= '<i>' . $element->feature->representation_L10n . '</i>: ' . $state_data . "; ";
2116
            }
2117
            break;
2118
          case 'QuantitativeData':
2119
            $descriptionString .= '<i>' . $element->feature->representation_L10n . '</i>: ' . compose_quant_stats($element) . "; ";
2120
            break;
2109
      if(isset($root_node->descriptionElements)) {
2110
        foreach ($root_node->descriptionElements as $element) {
2111
          switch ($element->class) {
2112
            case 'CategoricalData':
2113
              $state_data = compose_state_data($element);
2114
              $state_data = implode(', ', $state_data);
2115
              if (!empty($state_data)) {
2116
                $descriptionString .= '<i>' . $element->feature->representation_L10n . '</i>: ' . $state_data . "; ";
2117
              }
2118
              break;
2119
            case 'QuantitativeData':
2120
              $descriptionString .= '<i>' . $element->feature->representation_L10n . '</i>: ' . compose_quant_stats($element) . "; ";
2121
              break;
2122
          }
2121 2123
        }
2122 2124
      }
2123 2125
      // recurse child nodes

Also available in: Unified diff