BUGFIX Return NULL in Versioned::get_latest_version() if no record was found (fixes #4015)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76603 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-05-12 01:55:43 +00:00
parent 4c94455a4d
commit 21c295d2e3

View File

@ -713,6 +713,8 @@ class Versioned extends DataObjectDecorator {
$query = singleton($class)->buildVersionSQL("\"{$baseTable}\".\"RecordID\" = $id", "\"{$baseTable}\".\"Version\" DESC");
$query->limit = 1;
$record = $query->execute()->record();
if(!$record) return;
$className = $record['ClassName'];
if(!$className) {
Debug::show($query->sql());