diff --git a/plugins/API/RowEvolution.php b/plugins/API/RowEvolution.php index 6e31a13317320e5b9ee1f2c6ec809732dab75b12..c7086080896ef4260e6ba1a3b6fcd301b378eaff 100644 --- a/plugins/API/RowEvolution.php +++ b/plugins/API/RowEvolution.php @@ -360,9 +360,16 @@ class RowEvolution unset($metadata['logos']); $subDataTables = $dataTable->getDataTables(); + if (empty($subDataTables)) { + throw new \Exception("Unexpected state: row evolution API call returned empty DataTable\\Map."); + } + $firstDataTable = reset($subDataTables); + $this->checkDataTableInstance($firstDataTable); $firstDataTableRow = $firstDataTable->getFirstRow(); + $lastDataTable = end($subDataTables); + $this->checkDataTableInstance($lastDataTable); $lastDataTableRow = $lastDataTable->getFirstRow(); // Process min/max values @@ -533,4 +540,11 @@ class RowEvolution $label = SafeDecodeLabel::decodeLabelSafe($label); return $label; } + + private function checkDataTableInstance($lastDataTable) + { + if (!($lastDataTable instanceof DataTable)) { + throw new \Exception("Unexpected state: row evolution returned DataTable\\Map w/ incorrect child table type: " . get_class($lastDataTable)); + } + } }