From 08733b3812fffededf4f9c997c6ba85250c70243 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 16 Oct 2015 19:46:10 +0100 Subject: Do null check early, save some work --- slicer/db/sqlSelectDeserializer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp index ba5f944..5c46e11 100644 --- a/slicer/db/sqlSelectDeserializer.cpp +++ b/slicer/db/sqlSelectDeserializer.cpp @@ -91,12 +91,12 @@ namespace Slicer { for (auto col = 0u; col < columnCount; col += 1) { const DB::Column & c = cmd[col]; SqlSourcePtr h = new SqlSource(c); - auto fmpr = rmp->GetAnonChildRef([&c](Slicer::HookCommonPtr h) { - return boost::iequals(c.name.raw(), h->PartName()); - }); - if (fmpr) { - auto fmp = fmpr->Child(); - if (!h->isNull()) { + if (!h->isNull()) { + auto fmpr = rmp->GetAnonChildRef([&c](Slicer::HookCommonPtr h) { + return boost::iequals(c.name.raw(), h->PartName()); + }); + if (fmpr) { + auto fmp = fmpr->Child(); fmp->Create(); fmp->SetValue(h); fmp->Complete(); -- cgit v1.2.3