From deb1bfbcbaaa62acb2263ba797b5068e142a6353 Mon Sep 17 00:00:00 2001 From: Andrew Short Date: Fri, 4 Oct 2013 00:04:55 +1000 Subject: [PATCH] Fix Versioned::augmentSQL() when the data query was null. --- model/Versioned.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/model/Versioned.php b/model/Versioned.php index b2e2de3a0..d1b9417fe 100644 --- a/model/Versioned.php +++ b/model/Versioned.php @@ -182,13 +182,13 @@ class Versioned extends DataExtension { * @todo Should this all go into VersionedDataQuery? */ public function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) { - $baseTable = ClassInfo::baseDataClass($dataQuery->dataClass()); - - switch($dataQuery->getQueryParam('Versioned.mode')) { - // Noop - case '': - break; + if(!$dataQuery || !$dataQuery->getQueryParam('Versioned.mode')) { + return; + } + $baseTable = ClassInfo::baseDataClass($dataQuery->dataClass()); + + switch($dataQuery->getQueryParam('Versioned.mode')) { // Reading a specific data from the archive case 'archive': $date = $dataQuery->getQueryParam('Versioned.date');