diff options
author | Stefan Giehl <stefan@matomo.org> | 2022-11-03 01:50:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-03 01:50:07 +0300 |
commit | fd677d1927cf8119f6e26a2d04204006745e01ba (patch) | |
tree | 327568bc38137f68df91a3ffca34e5421345e6c0 /plugins | |
parent | 69ac1b589d5e798daeb04b2df97dcc956ead396c (diff) |
Prevent some possible exceptions (#19938)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Ecommerce/Controller.php | 2 | ||||
-rw-r--r-- | plugins/Goals/Reports/Get.php | 2 | ||||
-rw-r--r-- | plugins/Referrers/Reports/Get.php | 2 | ||||
-rw-r--r-- | plugins/VisitsSummary/Reports/Get.php | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/plugins/Ecommerce/Controller.php b/plugins/Ecommerce/Controller.php index dcc600e1b2..7e27aed99d 100644 --- a/plugins/Ecommerce/Controller.php +++ b/plugins/Ecommerce/Controller.php @@ -148,7 +148,7 @@ class Controller extends \Piwik\Plugins\Goals\Controller if (array_key_exists($columnName, $metrics) && array_key_exists($columnName, $return)) { - $pastValue = $previousDataRow->getColumn($columnName); + $pastValue = $previousDataRow ? $previousDataRow->getColumn($columnName) : 0; if (in_array($columnName, ['revenue', 'avg_order_revenue'])) { $numberFormatter = NumberFormatter::getInstance(); diff --git a/plugins/Goals/Reports/Get.php b/plugins/Goals/Reports/Get.php index 247e4c1de0..9e73143cea 100644 --- a/plugins/Goals/Reports/Get.php +++ b/plugins/Goals/Reports/Get.php @@ -194,7 +194,7 @@ class Get extends Base $value = reset($columns); $columnName = key($columns); - $pastValue = $previousDataRow->getColumn($columnName); + $pastValue = $previousDataRow ? $previousDataRow->getColumn($columnName) : 0; if (!is_numeric($value)) { return; diff --git a/plugins/Referrers/Reports/Get.php b/plugins/Referrers/Reports/Get.php index 0078102a21..52a5106481 100644 --- a/plugins/Referrers/Reports/Get.php +++ b/plugins/Referrers/Reports/Get.php @@ -90,7 +90,7 @@ class Get extends Base return; } - $pastValue = $previousDataRow->getColumn($columnName); + $pastValue = $previousDataRow ? $previousDataRow->getColumn($columnName) : 0; $currentValueFormatted = NumberFormatter::getInstance()->format($value); $pastValueFormatted = NumberFormatter::getInstance()->format($pastValue); diff --git a/plugins/VisitsSummary/Reports/Get.php b/plugins/VisitsSummary/Reports/Get.php index 7b482cac12..f9eded77b3 100644 --- a/plugins/VisitsSummary/Reports/Get.php +++ b/plugins/VisitsSummary/Reports/Get.php @@ -132,7 +132,7 @@ class Get extends \Piwik\Plugin\Report $view->config->compute_evolution = function ($columns, $metrics) use ($currentPrettyDate, $lastPrettyDate, $previousDataRow) { $value = reset($columns); $columnName = key($columns); - $pastValue = $previousDataRow->getColumn($columnName); + $pastValue = $previousDataRow ? $previousDataRow->getColumn($columnName) : 0; // Format $formatter = new MetricFormatter(); |