Skip to content

Commit acd0e38

Browse files
authored
Update JpGraphRendererBase.php - check existing of PlotLabel
I've got 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 found that it's necessary to check existing of PlotLabel before using its method getDataValue().
1 parent d767d46 commit acd0e38

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,7 +334,8 @@ private function renderPlotLine(int $groupID, bool $filled = false, bool $combin
334334
// Set the appropriate plot marker
335335
$this->formatPointMarker($seriesPlot, $marker);
336336
}
337-
$dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($index)->getDataValue();
337+
if ($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($index))
338+
$dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($index)->getDataValue();
338339
$seriesPlot->SetLegend($dataLabel);
339340

340341
$seriesPlots[] = $seriesPlot;

0 commit comments

Comments
 (0)