Skip to content

Commit 36f3168

Browse files
authored
Check existing of PlotLabel before using its method getDataValue()
I'v got that: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\FatalError: "Error: Uncaught Error: Call to a member function getDataValue() on bool in .../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/JpGraphRendererBase.php:337 I've found that it's necessary to check existing of PlotLabel before using its method getDataValue().
1 parent acd0e38 commit 36f3168

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/PhpSpreadsheet/Chart/Renderer/JpGraphRendererBase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,9 @@ private function renderPlotLine(int $groupID, bool $filled = false, bool $combin
334334
// Set the appropriate plot marker
335335
$this->formatPointMarker($seriesPlot, $marker);
336336
}
337-
if ($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($index))
337+
if ($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($index)) {
338338
$dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($index)->getDataValue();
339+
}
339340
$seriesPlot->SetLegend($dataLabel);
340341

341342
$seriesPlots[] = $seriesPlot;

0 commit comments

Comments
 (0)