From 1af4743deef00eb3a2cab1d6b2ba3cdb504b6c4d Mon Sep 17 00:00:00 2001
From: Aegir user <aegir@soft-nrg-portal.de>
Date: Tue, 19 Jul 2016 12:11:47 +0200
Subject: Issue #2264691 by mbehensky, Joanna_Kisaakye, hadsie: Creating
 default object from empty value...

---
 flot.module | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/flot.module b/flot.module
index 5e6f782..9f59b10 100644
--- a/flot.module
+++ b/flot.module
@@ -81,6 +81,7 @@ function template_preprocess_flot_graph(&$variables) {
     }
   }

+  $options->legend = isset($options->legend) ? $options->legend : new stdClass();
   if (isset($variables['legend']) && $variables['legend']) {
     if (!isset($options->legend)) {
       // Default position bottom
@@ -99,6 +100,9 @@ function template_preprocess_flot_graph(&$variables) {
   }
   $variables['options'] = $options;
   $legend_element = array();
+  if (!isset($options->legend->position)) {
+    $options->legend->position = 'bottom';
+  }
   if (isset($options->legend) && isset($options->legend->position) &&  $options->legend->position == 'bottom' && !isset($options->legend->container)) {
     $variables['element']['legendid'] = $variables['element']['id'] . '-legend';
     $options->legend->container = '#' . $variables['element']['legendid'];
@@ -148,9 +152,17 @@ function template_preprocess_flot_graph(&$variables) {
   if($zoom && (!isset($options->series->pie->show) || $options->series->pie->show == FALSE)) {
     $zoom_options = clone $options;
     $zoom_data = $data;
+    if(!isset($zoom_options->series)){
+        $zoom_options->series  = new stdClass();
+        $zoom_options->series->points  = new stdClass();
+        $zoom_options->series->lines  = new stdClass();
+    }
     $zoom_options->series->points->show = FALSE;
     $zoom_options->series->lines->lineWidth = 1;
     $zoom_options->series->shadowSize = 0;
+    if(!isset($zoom_options->grid)){
+        $zoom_options->grid = new stdClass();
+    }
     $zoom_options->grid->hoverable = FALSE;
     $zoom_options->selection['mode'] = 'x';
     $zoom_options->legend->show = FALSE;
@@ -165,6 +177,9 @@ function template_preprocess_flot_graph(&$variables) {
     }
     foreach ($zoom_data as &$zdata) {
       if (isset($zdata->lines) || isset($zdata->bars) || isset($zdata->pie)) {
+        if(!isset($zdata->points)){
+            $zdata->points = new stdClass();
+        }
         $zdata->points->show = FALSE;
       }
     }
@@ -419,6 +434,10 @@ class flotPie extends flot {
   function __construct($settings = NULL) {
     $this->show = TRUE;
     $this->radius = 1;
+    if(!isset($this->label)){
+        $this->label = new stdClass();
+        $this->label->background = new stdClass();
+    }
     $this->label->show = TRUE;
     $this->label->radius = 2/3;
     $this->label->threshold = 0.1;
@@ -469,9 +488,11 @@ class flotStylePie extends flotStyle {
     parent::__construct();
     $this->series->pie->show = TRUE;
     $this->series->pie->radius = 1;
+    $this->series->pie->label = new stdClass();
     $this->series->pie->label->show = TRUE;
     $this->series->pie->label->radius = 2/3;
     $this->series->pie->label->threshold = 0.1;
+    $this->series->pie->label->background = new stdClass();
     $this->series->pie->label->background->opacity = 1;
   }

--
1.9.1

