From 0421a68758817b75a5358a508a14ec7ed46b88f0 Mon Sep 17 00:00:00 2001
From: mattpiwik <matthieu.aubry@gmail.com>
Date: Sat, 2 Jun 2012 23:49:29 +0000
Subject: [PATCH] Fixes #3170

git-svn-id: http://dev.piwik.org/svn/trunk@6447 59fd770c-687e-43c8-a1e3-f5a4ff64c105
---
 plugins/ImageGraph/API.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/plugins/ImageGraph/API.php b/plugins/ImageGraph/API.php
index dd5f92fec9..9ccc0ef086 100644
--- a/plugins/ImageGraph/API.php
+++ b/plugins/ImageGraph/API.php
@@ -123,8 +123,11 @@ class Piwik_ImageGraph_API
 
 		try
 		{
-			//Fetch the metadata for given api-action
-			$apiParameters = array( 'idGoal' => $idGoal);
+			$apiParameters = array();
+			if(!empty($idGoal)) {
+				$apiParameters = array( 'idGoal' => $idGoal);
+			}
+			// Fetch the metadata for given api-action
 			$metadata = Piwik_API_API::getInstance()->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $languageLoaded, $period, $date);
 			if(!$metadata)
 			{
@@ -179,6 +182,8 @@ class Piwik_ImageGraph_API
 				}
 			}
 
+			$width = (int)$width;
+			$height = (int)$height;
 			if(empty($width))
 			{
 				$width = self::$DEFAULT_PARAMETERS[$graphType][self::WIDTH_KEY];
-- 
GitLab